See issue 57 for discussion and planned improvements.
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
/*jshint node:true globalstrict:true*/ | |
"use strict"; | |
var assert = require('assert'); | |
// | |
// Convenience function for building a simple UPDATE/SET/WHERE/RETURNING statement. | |
// | |
// e.g. | |
// |
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') | |
https = require('https'), | |
url = require('url'); | |
// proxy json requests to Twitter API, round-trip through JSON.parse/stringify: | |
http.createServer(function (req, res) { | |
if (req.url.indexOf('.json') == req.url.length - '.json'.length) { | |
var options = { host: 'api.twitter.com', path: req.url } | |
https.get(options, function(got) { |
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
CC = clang | |
MAIN = main | |
SRCS = main.o | |
default: $(MAIN) | |
$(MAIN): $(SRCS) | |
$(CC) -O0 -Wall -o $(MAIN) $(SRCS) -framework Foundation |
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
// preserve Twitter's style of JSON string encoding... | |
// escape higher value unicode (lowercase hex) | |
// escape < and > (uppercase hex) | |
// escape / in strings (\/) | |
// hugs! https://gist.github.com/1306986 | |
// http://stackoverflow.com/questions/4901133/json-and-escaping-characters | |
function escapedStringify(s, emit_unicode) { | |
var json = JSON.stringify(s); | |
return emit_unicode ? json : json.replace(/\//g, | |
function(c) { |
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
void setup() { | |
size(640,480); | |
frame.setResizable(true); | |
} | |
void draw() { | |
background(frameCount); | |
} |
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
web: node app.js |
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
// see http://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B0000_to_U.2BD7FF_and_U.2BE000_to_U.2BFFFF | |
function escapeBMP(n) { | |
return '\\u'+('0000'+n.toString(16)).slice(-4); | |
} | |
// see http://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B10000_to_U.2B10FFFF | |
function makeSurrogate(n) { | |
var a = n - 0x10000; | |
var highBits = a >> 10; | |
var lowBits = a & 0x3FF; |
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
// first of all make sure we have enough arguments (exit if not) | |
if (process.argv.length != 5) | |
{ | |
console.error("Usage: node csv2html.js input.csv template.ejs output.html") | |
console.error(); | |
console.error("Outputs the given template for each row in the given input.") | |
console.error("Uses the first row of the CSV as column names in the template.") | |
process.exit(1); | |
} |
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
# don't hate me for this Makefile, at least I provided one | |
BOOST_PATH = /Users/tom/Documents/Code/Cinder/Cinder/boost | |
main: main.o | |
g++ -o main main.o | |
main.o: main.cpp | |
g++ -c -I$(BOOST_PATH) -o main.o main.cpp |