Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / dom3d.js
Last active November 14, 2024 15:34
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; // ¯\\_(ツ)_/¯
@zulhfreelancer
zulhfreelancer / change-openssl-version.md
Last active August 18, 2024 07:56
How to switch OpenSSL version on Mac using Homebrew?

How to switch OpenSSL version on Mac using Homebrew?

Scenario: you have both OpenSSL 1.0 and 1.1 installed (using Brew) in your OSX system and you want to switch the current active version without removing other versions that already installed. Here is how to do it.

Step 1 - List all OpenSSL versions

$ ls -al /usr/local/Cellar/openssl*

/usr/local/Cellar/openssl:
@ggichure
ggichure / main.dart
Created October 17, 2019 18:54
flutter theme changer and persist with shared prefrences
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
//https://stackoverflow.com/a/53107519/10409567
void main() async {
// load the shared preferences from disk before the app is started
WidgetsFlutterBinding.ensureInitialized();
final prefs = await SharedPreferences.getInstance();
// create new theme controller, which will get the currently selected from shared preferences
@newvertex
newvertex / KeyPressEvent.js
Created September 17, 2016 10:24
Example: Detect keypress event in Node.js console app
var readline = require('readline');
readline.emitKeypressEvents(process.stdin);
if (process.stdin.isTTY)
process.stdin.setRawMode(true);
process.stdin.on('keypress', (chunk, key) => {
if (key && key.name == 'q')
process.exit();