Skip to content

Instantly share code, notes, and snippets.

require.paths.unshift(__dirname + '/modules', __dirname + '/lib/node', __dirname);
var express = require('express');
var app = module.exports = new express.Server();
app.configure(function() {
app.use(express.cookieDecoder());
app.use(express.session());
});
@tristanoneil
tristanoneil / gist:1632794
Created January 18, 2012 12:32
Importing unique data from a CSV into MySQL
LOAD DATA INFILE '/path/to/file' IGNORE INTO TABLE data.timeseries FIELDS TERMINATED BY ',' ENCLOSED BY '"' IGNORE 1 LINES;
@tristanoneil
tristanoneil / gist:1711388
Created January 31, 2012 16:16
reject columns
.reject { |key, value| columns.map(&:name).include?(key) }.keys
def ruby_in_btv
"Awesome"
end
test "ruby_in_btv"
assert_equal "Awesome", ruby_in_btv
end
@tristanoneil
tristanoneil / gist:2306146
Created April 4, 2012 22:29
sublime text settings
{
"color_scheme": "Packages/Color Scheme - Default/Tomorrow Night.tmTheme",
"draw_white_space": "all",
"tab_size": 2,
"theme": "Soda Light.sublime-theme",
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"font_face": "monaco",
"font_size": 12
}
class RepoController < UIViewController
def viewDidLoad
@data = []
BW::HTTP.get("https://api.github.com/users/gristmill/repos") do |response|
json = BW::JSON.parse(response.body.to_str)
json.each do |j|
@data << { name: j["full_name"], watchers: j["watchers_count"] }
end
@tristanoneil
tristanoneil / gist:4229885
Created December 7, 2012 01:03
Happy Hoppy Brown Ale
Original Gravity: 1.055
Final Gravity: 1.014
Primary: ~67 Degrees F 12 days
Secondary: 2 Weeks w/ 1 ounce of Whole Leaf Cascade
IBU: 40
Yeast: Wyeast 1332
9.0 lbs Pale Malt
1.0 lbs Crystal 60L