Skip to content

Instantly share code, notes, and snippets.

View cadwallion's full-sized avatar
⚒️
Building all the things

Andrew Nordman cadwallion

⚒️
Building all the things
View GitHub Profile
@cadwallion
cadwallion / github.js
Created August 28, 2011 13:56
Quick V3 API hack, assumes you handle the OAuth
var https = require('https');
var Github = module.exports = {
setAuthToken: function (token) {
this.access_token = token;
},
send: function (path, callbk) {
if (this.access_token != undefined) {
options = {
host: 'api.github.com',
body { color: white; }
@cadwallion
cadwallion / easyrss_new.js
Created September 2, 2011 13:40
Refactored parseURL
exports.parseURL = function(url, opts) {
var options={};
if(typeof opts=="function"){
options.cb = opts;
} else {
options=opts;
}
request(url, function(error, response, body) {
if (!error) {
@cadwallion
cadwallion / test_helper.rb
Created September 9, 2011 14:05
Adds timing to ActiveSupport::TestCase
# snip
Spork.prefork do
#snip
class ActiveSupport::TestCase
setup :mark_test_start_time
teardown :record_test_duration
def mark_test_start_time
@start_time = Time.now
end
@cadwallion
cadwallion / gist:1251845
Created September 29, 2011 20:32
Profile Service + Jasmine == Win?
var test = require('../spec_helper');
beforeEach(function() {
this.addMatchers({
toErrorWith: function (expectedMessage) {
var resp = this.actual;
this.actual = resp['error'];
this.message = function() {
return "Expected response to return error '"+expectedMessage+"'";
}
@cadwallion
cadwallion / music_program.rb
Created September 30, 2011 00:22
Demon's Music Collection Program
require "csv"
class CD
attr_reader :band_name, :album_name
def initialize(band_name, album_name)
@band_name = band_name
@album_name = album_name
end
def to_string
@cadwallion
cadwallion / Gemfile
Created October 2, 2011 03:51
SC2 Replay Analyzer
source "http://rubygems.org"
gem 'tassadar', :git => 'git://github.com/agoragames/tassadar.git'
@cadwallion
cadwallion / gist:1260003
Created October 3, 2011 19:32
Cures Cancer
function real_fib(n) {
var i;
var fibs = new Array(0, 1);
for(i=0; i<n; i++) {
fibs.push(fibs[0] + fibs[1]);
fibs.shift();
}
return fibs[0];
}
@cadwallion
cadwallion / gist:1264582
Created October 5, 2011 14:40
Connect Mongoose to Replica Set
var mongoose = require('mongoose');
mongoose.createSetConnection('mongodb://host1:12345/testdb, mongodb://host2:12345/testdb, mongodb://host3:12345/testdb', function (err) {
if (err) {
console.log("could not connect to DB: " + err);
}
})
// CONNECTED
@cadwallion
cadwallion / gist:1328330
Created October 31, 2011 18:21
WTF Homebrew...
1.9.3-p0 in shared_assets/ on jasmine
› brew install qt 1
==> Downloading https://downloads.sourceforge.net/project/machomebrew/Bottles/qt-4.7.3-bottle.tar.gz
######################################################################## 100.0%
Error: SHA1 mismatch
Expected: 6ab865b92db92cf2c49a332010f99566178d25cf
Got: a50123be33c96cba97d4bcee61f3859c7d52000e
Archive: /Users/cadwallion/Library/Caches/Homebrew/Bottles/qt-4.7.3.tar.gz
(To retry an incomplete download, remove the file above.)