Skip to content

Instantly share code, notes, and snippets.

View abloom's full-sized avatar

Andrew Bloom abloom

  • Turquoise Health
  • Chicago Il
View GitHub Profile
Blog.find({} function(err, docs) {
if (err) {
cb(err, null);
} else {
console.log(docs);
}
});
describe 'mean' do
let(:array_1) { [1, 2, 3, 4, 5, 5, 7] }
let(:array_2) { [4, 4, 5, 5, 6, 6, 6, 7] }
it "is defined as a method" do
defined?(mean).should eq 'method'
end
function createMy() {
var my = {},
privateVariable = 1;
function privateMethod() {
// ...
}
my.moduleProperty = 1;
my.moduleMethod = function () {
def super_fizzbuzz(array)
fizzbuzzed = []
array.each do |num|
if num % 3 == 0 && num % 5 == 0 # return "FizzBuzz"
elseif num % 3 == 0 # return "Fizz"
elseif num % 5 == 0 # return "Buzz"
elseif num /
place
end
# shortest_string is a method that takes an array of strings as its input
# and returns the shortest string
# +array+ is an array of strings
# shortest_string(array) should return the shortest string in +array+
# If +array+ is empty the method should return nil
# array.sort.first
def shortest_string(array)
new_count = [ ]
{
"id": 6,
"name": "Campaign with RFPs and IOs",
"budget_cents": 11100000,
"start_date": "2013-04-29",
"end_date": "2014-02-21",
"client": {
"id": 6,
"name": "Kwik-E-Mart"
},
@abloom
abloom / test.js
Created April 8, 2011 18:01 — forked from x1024/gist:794143
var http = require('http'),
should = require('should'),
io = require('socket.io'),
decode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').decode,
encode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').encode,
WebSocket = require('.npm/socket.io/0.6.8/package/support/node-websocket-client/lib/websocket.js').WebSocket;
exports['Socket.IO mocking'] = function(assert){
var _server = require('http').createServer(function(){});
// A mock client object.
module Frylock
attr_accessor :app
def config
@config ||= Frylock::Config.new(app || Rails)
end
end
sudo su postgres -c '/opt/local/lib/postgresql84/bin/initdb -D /opt/local/var/db/postgresql84/defaultdb'
sudo sed -i -e 's/#client_min_messages = notice/client_min_messages = error/' /opt/local/var/db/postgresql84/defaultdb/postgresql.conf
sudo sed -i -e 's/#log_min_messages = warning/log_min_messages = error/' /opt/local/var/db/postgresql84/defaultdb/postgresql.conf
sudo /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper start
sudo su postgres -c '/opt/local/lib/postgresql84/bin/createuser -s mms'
sudo su postgres -c '/opt/local/lib/postgresql84/bin/createuser -s YOUR_USER_NAME'
/opt/local/lib/postgresql84/bin/createdb mms_development
/opt/local/lib/postgresql84/bin/createdb mms_test
ActionController::Routing::Routes.draw do |map|
map.resources :fans
map.resources :league_players
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.login '/login', :controller => 'sessions', :action => 'new'
map.check '/check', :controller => 'sessions', :action => 'create'