Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / dom3d.js
Last active September 28, 2025 08:09
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; // ¯\\_(ツ)_/¯
@kimamula
kimamula / Optional.ts
Last active December 3, 2020 20:12
Implementation of Optional (Maybe) in TypeScript
class Some<A> implements Optional<A> {
constructor(private a: A) {
}
getOrElse(a: A) {
return this.a;
}
map<B>(func: (a: A) => B) {
return Optional(func(this.a));
}
match<B>(cases: {
@Noitidart
Noitidart / _ff-addon-snippet-WinAPI-ShowWindowHide.js
Created January 24, 2015 23:14
_ff-addon-snippet-WinAPI-ShowWindowHide - Using js-ctypes and WinAPI method of ShowWindow to hide a window. [windows] [jsctypes]
Cu.import('resource://gre/modules/ctypes.jsm')
var wintypesInit = function() {
// BASIC TYPES (ones that arent equal to something predefined by me)
this.BOOL = ctypes.bool;
this.HWND = ctypes.voidptr_t;
this.INT = ctypes.int;
// CONSTANTS
this.SW_HIDE = 0;
@aldrinleal
aldrinleal / arquivo.js
Created June 1, 2014 17:31
Fonte do Plugin Chrome do "Guardião Itaú"
"function" != typeof String.prototype.a && (String.prototype.a = function (a) {
return this.slice(0, a.length) == a
});
var c = 0,
d = 1;
function e() {
var a = document.getElementById("sf");
document.body.removeChild(a);
a = document.createElement("object");
//
// returns a list of all elements under the cursor
//
function elementsFromPoint(x,y) {
var elements = [], previousPointerEvents = [], current, i, d;
// get all elements via elementFromPoint, and remove them from hit-testing in order
while ((current = document.elementFromPoint(x,y)) && elements.indexOf(current)===-1 && current != null) {
// push the element and its current style
@Protonk
Protonk / lcg.js
Last active March 26, 2023 22:26
Simple Linear Congruential Generator in Javascript
// A simple Linear Congruential Generator
// Establish the parameters of the generator
var m = 25,
// a - 1 should be divisible by m's prime factors
a = 11,
// c and m should be co-prime
c = 17;
// Setting the seed
var z = 3;