Skip to content

Instantly share code, notes, and snippets.

View ElliotChong's full-sized avatar
✌️

Elliot Chong ElliotChong

✌️
View GitHub Profile

================

If your language works like this by default..

var x = {a: 5};
var y = {a: 5};
x === y; // => false
@ElliotChong
ElliotChong / Highlander.js
Last active August 29, 2015 14:14
When you're the only script that should work on a page.
var HighlanderJS = (function (immortals) {
var highlander = {};
for (var immortal in immortals) {
highlander[immortal] = immortals[immortal];
delete immortals[immortal];
}
immortals.HighlanderJS = function (onlyOne) {
onlyOne.apply(highlander);
};
@ElliotChong
ElliotChong / benchmark.coffee
Created August 19, 2014 20:00
Super quick and very dirty memory benchmark of Immutable JS.
heapdump = require "heapdump"
Immutable = require "immutable"
pixels = 256 * 256
iterations = 1000
# Immutable
testImmutable = ->
# Simulate a pixel grid
grid = Immutable.Vector()