A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$
if your browser aliases it:
~ 108 byte version
var http = require('http'); | |
var path = require('path'); | |
var fs = require('fs'); | |
var AUDIOFILE = "./audio.ogg"; | |
function serveWithRanges(request, response, content) { | |
var range = request.headers.range; | |
var total = content.length; | |
var parts = range.replace(/bytes=/, "").split("-"); |
!function (window) {"use strict"; | |
// by WebReflection - WTFPL License | |
var | |
prefixes = "r webkitR mozR msR oR".split(" "), | |
process = "process", | |
nextTick = "nextTick", | |
i = 0, | |
p = window[process] || (window[process] = {}) | |
; | |
while (!p[nextTick] && i < prefixes.length) |
function getFnName(fn) { | |
fn = Object(fn) | |
var F = typeof fn == 'function' | |
var N = fn.name | |
var S = F && ((N && ['', N]) || fn.toString().match(/function ([^\(]+)/)) | |
return (!F && 'not a function') || (S && S[1] || 'anonymous'); | |
} | |
console.log(getFnName(String)); // 'String' | |
console.log(getFnName(function test(){})); // 'test' |
var Promise = require('bluebird'); | |
var promiseWhile = function(condition, action) { | |
var resolver = Promise.defer(); | |
var loop = function() { | |
if (!condition()) return resolver.resolve(); | |
return Promise.cast(action()) | |
.then(loop) | |
.catch(resolver.reject); |
/** | |
* At least two points are needed to interpolate something. | |
* @class Lagrange polynomial interpolation. | |
* The computed interpolation polynomial will be reffered to as L(x). | |
* @example | |
* var l = new Lagrange(0, 0, 1, 1); | |
* var index = l.addPoint(0.5, 0.8); | |
* console.log(l.valueOf(0.1)); | |
* | |
* l.changePoint(index, 0.5, 0.1); |
public class Perlin { | |
public static double OctavePerlin(double x, double y, double z, int octaves, double persistence) { | |
double total = 0; | |
double frequency = 1; | |
double amplitude = 1; | |
for(int i=0;i<octaves;i++) { | |
total += perlin(x * frequency, y * frequency, z * frequency) * amplitude; | |
amplitude *= persistence; |
public class Perlin { | |
public int repeat; | |
public Perlin(int repeat = -1) { | |
this.repeat = repeat; | |
} | |
public double OctavePerlin(double x, double y, double z, int octaves, double persistence) { | |
double total = 0; |
(function(window){ | |
var EVENT_EXISTS = 'GlobalEvents: Event already exists.'; | |
var eventIsRunning, | |
_eventStack, | |
_findByName, | |
stackEvent, | |
removeEvent, | |
eventListener, |