This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; // ¯\\_(ツ)_/¯ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |