sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
brew install git
cd /usr/local
git init
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
# -------------------------------------------- | |
# General | |
# -------------------------------------------- | |
set :shared_children, %w(cache logs) # Shared directories, these directories contain generated content which should not be wiped out during deployments. | |
set :application, "domain.com" # Application name | |
set :deploy_to, "/var/www/#{application}/#{stage}" # Path where files are deployed to ... | |
# -------------------------------------------- | |
# Server | |
# -------------------------------------------- |
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
/* | |
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace | |
so it's better encapsulated. Now you can have multiple random number generators | |
and they won't stomp all over eachother's state. | |
If you want to use this as a substitute for Math.random(), use the random() | |
method like so: | |
var m = new MersenneTwister(); |
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
/* Copyright (c) 2011 Aza Raskin | |
| | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | |
| documentation files (the "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is furnished to do so, subject | |
| to the following conditions: | |
| | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions | |
| of the Software. |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
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 express = require('express'), | |
request = require('request'), | |
BufferList = require('bufferlist').BufferList, | |
sys = require('sys'); | |
var app = express.createServer( | |
express.logger(), | |
express.bodyDecoder() | |
); |
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
module Jekyll | |
class LessCssFile < StaticFile | |
def write(dest) | |
# do nothing | |
end | |
end | |
# Expects a lessc: key in your _config.yml file with the path to a local less.js/bin/lessc | |
# Less.js will require node.js to be installed |
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 http = require('http'), | |
sys = require('sys'), | |
fs = require('fs'), | |
io = require('socket.io'); | |
var server = http.createServer(function(request, response) { | |
response.writeHead(200, { | |
'Content-Type': 'text/html' | |
}); | |
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
/* | |
* Based on https://gist.github.com/583836 from http://stackoverflow.com/questions/3709391/node-js-base64-encode-a-downloaded-image-for-use-in-data-uri. | |
* Neither that gist nor this one work for me in 0.2.x or 0.3.x. | |
*/ | |
var request = require('request'), | |
BufferList = require('bufferlist').BufferList, | |
sys = require('sys'), | |
bl = new BufferList(), | |
url = 'http://nodejs.org/logo.png' | |
; |
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
// A* path finding algorithm for impactjs game engine | |
// adapted from http://stormhorse.com/a_star.js | |
// via http://46dogs.blogspot.com/2009/10/star-pathroute-finding-javascript-code.html | |
// impact-ified by jminor - http://pixelverse.org/ | |
/* Example: | |
this.pathFinder = new PathFinder(); | |
var start = [((this.pos.x+this.size.x/2) / tilesize).floor(), ((this.pos.y+this.size.y/2) / tilesize).floor()]; | |
var destination = [((target.pos.x+target.size.x/2) / tilesize).floor(), ((target.pos.y+target.size.y/2) / tilesize).floor()]; |
OlderNewer