Implemented with: https://github.com/bminer/node-twilio-api
This file contains hidden or 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
Hogan = require 'hogan' | |
fs = require 'fs' | |
# The templates route generates the JavaScript file | |
# for the server side compiled Hogan templates. | |
exports.templates = (req, res) -> | |
compileTemplate = (template, callback) -> | |
filename = __dirname + '/../templates/' + template + '.hogan' | |
fs.readFile filename, (err, contents) -> | |
if err |
This file contains hidden or 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
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 |
This file contains hidden or 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 dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, cluster = require('cluster'); | |
var app = module.exports = express.createServer() | |
, io = require('./socket')(app); |
This file contains hidden or 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
#! /usr/local/bin/node | |
// ^-- Tell the terminal which interpreter to use for the execution | |
// ^-- of this script. For our purposes, we'll be using the Node.js | |
// ^-- interpretor (which was installed in the local BIN directory | |
// ^-- using HomeBrew. | |
// ---------------------------------------------------------- // | |
// ---------------------------------------------------------- // |
This file contains hidden or 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 util = require('util'), | |
http = require('http'), | |
events = require('events'); | |
var Twitter = function(opts) { | |
this.username = opts.username; | |
this.password = opts.password; | |
this.track = opts.track; | |
this.data = ''; | |
}; |
This file contains hidden or 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'), | |
url = require('url'), | |
ios = require('socket.io'), | |
fs = require('fs'); | |
var server = http.createServer(function(req, res) { | |
res.writeHead(200, {'Content-Type': 'text/html'}); | |
res.end('<h1>Hello NodeJs</h1>'); | |
}); |
This file contains hidden or 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'); | |
var server = http.createServer(function(req, res) { | |
// console.log(req); // debug dump the request | |
// If they pass in a basic auth credential it'll be in a header called "Authorization" (note NodeJS lowercases the names of headers in its request object) | |
var auth = req.headers['authorization']; // auth is in base64(username:password) so we need to decode the base64 | |
console.log("Authorization Header is: ", auth); |
This file contains hidden or 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
#!/usr/bin/env python | |
def convert_mph(match): | |
try: | |
mph = int(match.group(0).split(' ')[0]) | |
kph = mph*1.6 | |
#return "%.1f kph" % (kph,) | |
return "%s kph" % (int(round(kph)),) | |
except: | |
return match.group(0) |