Skip to content

Instantly share code, notes, and snippets.

View grantmichaels's full-sized avatar

grantmichaels grantmichaels

View GitHub Profile
<html>
<head>
<script type="text/javascript" src="jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="processing-1.2.1.min.js"></script>
<script type="text/javascript" src="websocket_processing.js"></script>
</head>
<body>
<canvas id="processing"></canvas>
</body>
</html>
@grantmichaels
grantmichaels / lahey_pizza.txt
Created May 13, 2012 21:21 — forked from mrb/lahey_pizza.txt
Lahey Pizza
The pizza recipe is based on the book "My Bread" by Jim Lahey, which I
HIGHLY recommend. It has bunch of recipes based around the idea of
"no knead" bread - basically long fermentation times take place of
lengthy, annoying kneading. You can make great loaves with a similar
technique to the pizza recipe below. This is a kind of "Roman" style
pizza where you stretch the dough very thin on two 13" x 18" sheet
pans, cut the ingredients very thinly, layer it, and bake it hot for
about 25 minutes. To make two pies:
3 3/4 cups or 500 grams Bread Flour
@grantmichaels
grantmichaels / zappa-processing.coffee
Created May 13, 2012 20:55 — forked from anissen/zappa-processing.coffee
Processing.js demonstration (server included) using zappa, coffeekup and node.js in 30 (!) lines of code
require('zappa') ->
@get '/': -> @render 'index', layout: no
@view index: ->
doctype 5
html ->
head ->
title 'Zappa + CoffeeKup + Processing'
style '''body { background-image:url('http://icanhasnoise.com/1d0b07-4a2219/40x1500/4'); text-align: center; } header { font-family: 'Lobster Two', cursive; font-size: 28px; color: white; text-shadow: 3px 3px 3px brown; }'''
link rel: 'stylesheet', href: 'http://fonts.googleapis.com/css?family=Lobster+Two&v2'
script src: 'http://processingjs.org/content/download/processing-js-1.3.6/processing-1.3.6-api.min.js'
@grantmichaels
grantmichaels / parseAndModifyHtml.js
Created May 13, 2012 20:53 — forked from clarkdave/parseAndModifyHtml.js
Using node.js to parse HTML with jsdom and modify it with jQuery
/**
* npm install jsdom
* npm install jquery
*/
var html = "<!doctype html><html><body><h1>Hello world!</h1></body></html>";
/* parse the html and create a dom window */
var window = require('jsdom').jsdom(html, null, {
// standard options: disable loading other assets
@grantmichaels
grantmichaels / Reduce, Kaffeine, NodeJS and Redis
Created May 13, 2012 20:53 — forked from jedisct1/Reduce, Kaffeine, NodeJS and Redis
Tiny recommendation engine using Map/Reduce, Kaffeine, NodeJS and Redis
sys = require "sys";
http = require "http";
url = require "url";
connect = require "connect";
redis = require "redis";
hashRing = require "hash_ring";
Sharding = {
servers = { "127.0.0.1 10000 6378": 1 };
ring = new hashRing.HashRing servers;
@grantmichaels
grantmichaels / server.js
Created May 13, 2012 20:52 — forked from mixonic/server.js
Node.js + Socket.io + Bash. A collaborative terminal for your browser.
//
// This server will start a bash shell and expose it
// over socket.io to a browser. See ./term.html for the
// client side.
//
// You should probably:
//
// npm install socket.io
// curl -O https://github.com/LearnBoost/Socket.IO/raw/master/socket.io.min.js
//
@grantmichaels
grantmichaels / app.coffee
Created May 13, 2012 20:51 — forked from srohde/app.coffee
Setup Redis as Node.js Express Session Storage
express = require 'express'
RedisStore = require('connect-redis')(express)
# Heroku redistogo connection
if process.env.REDISTOGO_URL
rtg = require('url').parse process.env.REDISTOGO_URL
redis = require('redis').createClient rtg.port, rtg.hostname
redis.auth rtg.auth.split(':')[1] # auth 1st part is username and 2nd is password separated by ":"
# Localhost
else
@grantmichaels
grantmichaels / phantom.coffee
Created May 13, 2012 20:51 — forked from BinaryMuse/phantom.coffee
Take screenshots with Phantom.js from Node.js
#!/usr/bin/env coffee
# Call the program with: coffee phantom.coffee http://url.to/screengrab
phantom = require 'phantom' # npm install phantom
child_process = require 'child_process'
url = process.argv[2]
createScreenshot = (page, filename) ->
@grantmichaels
grantmichaels / .gitignore
Created May 13, 2012 20:51 — forked from jonmarkgo/.gitignore
Two-Factor Authentication with Node.js and Twilio - Completed Example
.DS_Store
node_modules
@grantmichaels
grantmichaels / chat.html
Created May 13, 2012 20:51 — forked from matheustardivo/chat.html
Simple Chat app using Node.js and Redis
<!DOCTYPE html>
<html>
<head>
<title>Node.js chat</title>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript" src="/nowjs/now.js"></script>
<script type="text/javascript">
$(document).ready(function() {
now.receiveMessage = function(time, name, message) {