This file contains 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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains 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
<!doctype html> | |
<a href="/">link</a> | |
<img src="/img.png"> | |
<div contenteditable></div> |
This file contains 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
[].slice.call(document.getElementsByTagName('img')).map(function(i) { | |
var src = i.src, i2 = new Image(); | |
i2.src = src | |
return { | |
src: src, | |
i1: i, | |
i2: i2 | |
} | |
}).filter(function(i) { | |
return !(i.i1.width === i.i2.width || i.i1.height === i.i2.height) |
This file contains 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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains 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 roll(die) { | |
var result = 0, a = /(\d+)d(\d+)(?:([\+\-\*\/])(\d+))?/.exec(die); | |
var times = a[1], sides = a[2], op = a[3], mod = +a[4]; | |
result = roll.raw(times, sides); | |
if(op && mod) result = roll.ops[op.replace(/x/g, '*')](result, mod); | |
return result | |
} | |
roll.raw = function(times, sides, total) { | |
total = total || 0; | |
total += Math.ceil(Math.random() * sides); |
This file contains 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 Point(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
Point.prototype.dist = function dist(p) { | |
return Math.sqrt(Math.pow(Math.abs(this.x - p.x), 2) | |
+ Math.pow(Math.abs(this.y - p.y), 2)); | |
} | |
Point.prototype.toString = function() { | |
return '(' + this.x + ',' + this.y + ')' |
This file contains 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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains 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
/** | |
* OLQOS Home page | |
*/ | |
* { | |
box-sizing: border-box | |
} | |
body, html, #container { | |
height: 100%; |
This file contains 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
/** | |
* Proxy for accessing ES6 Maps like objects. | |
* Usage example: | |
* | |
* var p = new MapProxy(); | |
* p['key'] = 'value'; | |
* if ('key' in p) { | |
* console.log(p.key); | |
* } | |
* delete p.key; |
This file contains 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
/** Sample die roller */ | |
function die(pattern) { | |
let [, sign = '+', amt = 1, sides = 6, num, mod] = die.regex.exec(pattern) | |
let gen | |
if (num) { | |
gen = _.fill(Number(num)) | |
} else { | |
let die = _.func(() => Math.floor(Math.random() * sides) + 1) | |
gen = _.combine(sum, ...Array(amt).fill(die)) | |
} |
OlderNewer