Skip to content

Instantly share code, notes, and snippets.

View davidguttman's full-sized avatar

David Guttman davidguttman

View GitHub Profile
@davidguttman
davidguttman / deploy_rails_app_on_ubuntu.md
Created October 18, 2011 06:11 — forked from he9lin/deploy_rails_app_on_ubuntu.md
Setup Rails application production environment on Ubuntu

Setup Rails application production environment on Ubuntu

Add deploy user

ssh root@YOURDOMAIN
adduser deploy
visudo # Add deploy ALL=(ALL) ALL

Install necessary libraries

@davidguttman
davidguttman / perlin-noise-classical.js
Created November 9, 2011 15:37 — forked from banksean/perlin-noise-classical.js
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/

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:

{
"name": "example",
"version": "0.0.1",
"devDependencies": {
"hbsfy": "~0.1.5"
},
"browserify": {
"transform": "hbsfy"
}
}
// data comes from here http://stat-computing.org/dataexpo/2009/the-data.html
// download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv
// 1994.csv should be ~5.2 million lines and 500MB
// importing all rows into leveldb took ~50 seconds on my machine
// there are two main techniques at work here:
// 1: never create JS objects, leave the data as binary the entire time (binary-split does this)
// 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this)
var level = require('level')

First, install dnsmasq using brew:

$ brew update
$ brew install dnsmasq

Then create your configuration

So you might have set up dnsmasq with this tutorial but then you notice that you can't set cookies to subdomains of localhost or for all of localhost's subdomains (see why).

So we set up a custom "localhost", that I'll call local.host, but you can pick whatever you want, as long as it contains at least one dot. Just adapt the first two commands.

$ # add to hosts list
$ sudo echo "127.0.0.1 local.host" >> /private/etc/hosts
$ # tell your dns server about it
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/