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
//Bookmarklet Code | |
$('head style').each(function() {if ($(this).attr('id') && $(this).attr('id').indexOf('less:') > -1) {var lesscode = $(document.createElement('div'));lesscode.html($(this).text().replace(/\/\*.*?\*\//g,' ').replace(/[ ]{2,100}/g,' '));lesscode.css('padding','20px').css('font-size','10px').css('background-color','#ddd').css('font-family','monospace');$('body:last-child').append(lesscode);} }); | |
//Legible version | |
$('head style').each(function() { | |
if ($(this).attr('id') && $(this).attr('id').indexOf('less:') > -1) { | |
var lesscode = $(document.createElement('div')); | |
//Clean up a lot of comments and white space... | |
lesscode.html($(this).text(). |
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
var shuffleAndValidateFiles = function(files) { | |
var F = new Array(); | |
while (files.length > 0) { | |
var N = Math.floor(Math.random()*files.length); | |
if ((files[N] instanceof File) && !files[N].hidden) { | |
F.push(files[N]); | |
} | |
files.splice(N,1); |
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
class Boid { | |
PVector pos; | |
PVector spd; | |
PVector acc; | |
Boid() { this(random(0, width), random(0, height)); } | |
Boid(float x, float y) { this(x, y, random(0,1), random(0,1)); } | |
Boid(float x, float y, float xspd, float yspd) { | |
pos = new PVector(x, 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
// Thanks to [liangzan's gist](https://gist.github.com/807712) | |
rmdirSyncForce = function(path) { | |
var files, file, fileStats, i, filesLength; | |
if (path[path.length - 1] !== '/') { | |
path = path + '/'; | |
} | |
files = fs.readdirSync(path); | |
filesLength = files.length; |
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
# GITBAREDIR e.g. "/home/web/present-company.git" | |
GITBAREDIR=`pwd`; | |
# GITPROJECTDIR e.g. "present-company" | |
GITPROJECTDIR=`basename $PWD | sed 's/.git//g'`; | |
# Stop the application, move up on directory | |
npm stop; | |
cd ..; |
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
node_modules |
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
<style type='text/css'> html, body { margin: 0; padding: 0; border: 0; } </style> |
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
var perlin = require('perlin').noise.perlin3 | |
var fill = require('ndarray-fill') | |
var zeros = require('zeros') | |
var scale = 0.075 | |
var threshold = 0.125 | |
// Untested in 3D, but "theoretically" this should | |
// work. Using the equivalent 2d getter with the | |
// continuous-box2d demo works well. |
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
// Load up the `raf` module. | |
var raf = require('raf') | |
// Create the canvas, and add it | |
// to the page. | |
var canvas = document.createElement('canvas') | |
var ctx = canvas.getContext('2d') | |
var width = 500 | |
var height = 300 |
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
// Load up the `raf` module. | |
var raf = require('raf') | |
var controls = require('kb-controls-iframed')({ | |
'W': 'up', | |
'A': 'left', | |
'S': 'down', | |
'D': 'right', | |
'<up>': 'up', | |
'<left>': 'left', | |
'<down>': 'down', |
OlderNewer