Skip to content

Instantly share code, notes, and snippets.

@Gozala
Gozala / example.js
Created January 29, 2012 03:46
Workaround for lack of "tail call optimization" in JS
// Lack of tail call optimization in JS
var sum = function(x, y) {
return y > 0 ? sum(x + 1, y - 1) :
y < 0 ? sum(x - 1, y + 1) :
x
}
sum(20, 100000) // => RangeError: Maximum call stack size exceeded
// Using workaround
@stevegraham
stevegraham / adam.css
Created February 8, 2012 19:13
spotify app stylesheets
/**
* Adam Theme / Dark Theme
* Standard Layout for Spotify Client
* Defines the basic styles for an app
* @copyright 2011 by Spotify
*/
/**
* Declarations for Adam Theme
*
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@willurd
willurd / web-servers.md
Last active May 25, 2024 13:16
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@FGRibreau
FGRibreau / 0_readme.md
Created November 2, 2013 22:56
Mock NodeJS net.Socket with ReadWriteStream
var dummySocket = new ReadWriteNetStream();

// Debug
dummySocket.on('data', function(data){
console.log('write received', data);
});

dummySocket.write('hey !');
@branneman
branneman / app.js
Last active February 5, 2021 21:58
Node.js application entry-point files
#!/usr/bin/env node
'use strict';
var spawn = require('child_process').spawn;
var args = [
'--harmony',
'app/bootstrap.js'
];
@gre
gre / randomsquares.glsl
Last active April 17, 2016 10:50 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
// General parameters
uniform sampler2D from;
uniform sampler2D to;
uniform float progress;
uniform vec2 resolution;
@gre
gre / burn.glsl
Created May 20, 2014 09:06 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
uniform vec3 color;
void main() {
@benraziel
benraziel / pixelize.glsl
Created May 20, 2014 19:32 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
@nwoeanhinnogaehr
nwoeanhinnogaehr / Kaleidoscope.glsl
Created May 23, 2014 19:02 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
uniform float speed;
uniform float angle;
uniform float power;