Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / dom3d.js
Last active May 6, 2024 20:17
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@markasoftware
markasoftware / enterprise_token.rb
Last active May 6, 2024 20:15
OpenProject Enterprise mode for free
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ it doesn't show that enterprise mode is enabled in the settings, but all ################
############ enterprise mode features, such as KanBan boards, are enabled. ################
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 6, 2024 20:14
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@zmts
zmts / tokens.md
Last active May 6, 2024 20:13
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@wojteklu
wojteklu / clean_code.md
Last active May 6, 2024 20:13
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

this file contains a simple script for connecting to mongodb database for deleting all the data from a collection and importing data to a collection:

  • you can delete all the data in your collection: bun importDevData.ts --delete
  • you can import your json data in your collection: bun importDevData.ts --import
import dotenv from "dotenv";
import mongoose from "mongoose";
import fs from "fs";

/**
@dino-su
dino-su / ClockText.kt
Created September 29, 2022 03:40
Compose TextClock
@Composable
fun ClockText() {
val currentTimeMillis = remember {
mutableStateOf(System.currentTimeMillis())
}
LaunchedEffect(key1 = currentTimeMillis) {
while (true) {
delay(250)
currentTimeMillis.value = System.currentTimeMillis()
@talkingmoose
talkingmoose / Match Version Number or Higher.bash
Last active May 6, 2024 20:13
Generates a regular expression (regex) that matches the provided version number or higher. Useful for Jamf Pro's "matches regex" operator in searches and smart groups where the results need to be the current version of an app or higher.
#!/bin/bash
<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
https://gist.github.com/2cf20236e665fcd7ec41311d50c89c0e
@filipelinhares
filipelinhares / vim.md
Last active May 6, 2024 20:13
Vim basic commands

Vim basic commands

A

  • a Enter into insert mode after the character your cursor is on.
  • A Enter into insert mode at the end of the current line.

B

  • b Move cursor to first character of previous word.
  • B Move cursor to first character of previous non-blank series of characters.
  • Ctrl+b Scroll page backwards (move up in the file).
@amlang
amlang / find json key value pair regex
Last active May 6, 2024 20:10
Regex find key and value pair in JSON formated string
# PHP / Ruby
# Regex find key and value pair in JSON formated string
# Match 1: Key
# Match 2: Value
# https://regex101.com/r/zR2vU9/4
# http://rubular.com/r/KpF3suIL10
# http://stackoverflow.com/questions/14349889/how-to-use-a-regular-expression-to-extract-json-fields/35129815#35129815
(?:\"|\')(?<key>[^"]*)(?:\"|\')(?=:)(?:\:\s*)(?:\"|\')?(?<value>true|false|[0-9a-zA-Z\+\-\,\.\$]*)