Skip to content

Instantly share code, notes, and snippets.

View davidguttman's full-sized avatar

David Guttman davidguttman

View GitHub Profile
// From http://ianww.com/blog/programming/optimizing-three-js-performance-simulating-tens-of-thousands-of-independent-moving-objects/
// MIT Licensed
function timedChunk(particles, positions, fn, context, callback){
var i = 0;
var tick = function() {
var start = new Date().getTime();
for (; i < positions.length && (new Date().getTime()) - start < 50; i++) {
fn.call(context, particles[i], positions[i]);
}
if (i < positions.length) {
@davidguttman
davidguttman / json_fetch.coffee
Created January 18, 2013 22:41
browserify json streaming (from Max Ogden's examples)
JSONStream = require 'JSONStream'
fetch = require './stream_fetch'
module.exports = (url) ->
stream = fetch url
json = JSONStream.parse [true]
stream.pipe json
return json

It's our birthday!

This month's JSLA will be at the Google office in Venice, Thursday March 28th @ 7pm. There will be talks on procedural sketching with Paper.js, Browserify v2 from @substack himself, and a short JavaScript Made Simple talk on arrays. Don't forget to RSVP, Google won't let you in if you're not on the list.

RSVP: http://js.la

M-Go

Our sponsor this month is M-go. They are hiring...

window.addEventListener("load",function() {
setTimeout(function(){
window.scrollTo(0, 1);
}, 0);
});

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

newjs () {
if [ "$@x" != "x" ]; then
git clone git://github.com/davidguttman/base-app.git "$@" && \
cd "$@" && \
rm -rf .git/ && \
git init && \
npm install
else
echo "No project name supplied..."
fi
@davidguttman
davidguttman / index.js
Created September 3, 2013 00:18
requirebin sketch
var rainbow = require('rainbow-load');
rainbow.show()
setTimeout(function() {rainbow.hide()}, 5000);
{
"name": "example",
"version": "0.0.1",
"devDependencies": {
"hbsfy": "~0.1.5"
},
"browserify": {
"transform": "hbsfy"
}
}
@davidguttman
davidguttman / async-hooks.js
Created September 13, 2013 23:48
What async level-hooks could look like
var LevelUp = require('levelup');
var Sublevel = require('level-sublevel')
var dbLoc = './test'
var opts = {valueEncoding: 'json'}
var db = Sublevel(LevelUp(dbLoc, opts));
var pageviews = db.sublevel('pageviews')
var sessions = db.sublevel('sessions')
@davidguttman
davidguttman / index.js
Created September 27, 2013 19:38
requirebin sketch
var es = require('event-stream')
// // // // // // // // // // // // // // //
window.colorStream = createColorStream()
document.body.appendChild(colorStream.swatch)
var colors = ['red', 'green', 'blue']
colors.forEach(function(color) {
var slider = createSlider()