Skip to content

Instantly share code, notes, and snippets.

@joannecheng
joannecheng / _.md
Created February 20, 2013 01:04
circle
# TODO -
# Geocode addresses
# Parse start/end date
#
import scraperwiki
import urllib2
import re
from bs4 import BeautifulSoup
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joannecheng
joannecheng / curry.js
Created December 9, 2012 20:56
Currying (From 'JavaScript Patterns' book)
function add(x, y) {
if (typeof y === 'undefined') {
// create closure around function below
return function(y) {
x + y;
}
}
return x + y;
}
require 'spec_helper'
describe User do
describe "#initialize"
context 'with all parameters' do
it "works" do
user = User.new :first_name => "slkdfjlaskdf"
user.first_name.should == ""
user.last_name.should == ""
end
@joannecheng
joannecheng / bind_test.rb
Created November 2, 2012 14:58
Ruby Bindings
class SampleClass
def initialize
@str = "The Quick Brown Fox"
end
def get_binding
binding
end
end
@joannecheng
joannecheng / install.sh
Last active October 11, 2015 09:47
things I need on linux environments
# General things
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev curl wget git-core postgresql mongodb
# install rbenv and Ruby 1.9.3
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
source .profile
@joannecheng
joannecheng / jruby-sigar.rb
Created October 4, 2012 16:39
More jruby/sigar notes
require 'java'
Dir["vendor/sigar/*.jar"].each { |jar| require jar }
@joannecheng
joannecheng / quiz-1.md
Created September 26, 2012 16:29 — forked from ahoward/quiz-1.md
quiz-1.md
So you think you wanna be a web developer...

Fork this, update your copy with answers.

They don't need to be precise - pseudo-code is fine in most cases.

Some questions don't have correct answers.

@joannecheng
joannecheng / build.rb
Created August 15, 2012 21:16
ant build scripts in jruby
# Make sure ant is installed and available on the machine
require 'ant'
ant :name => 'hello', :default => 'hello' do
target :name => 'hello' do
echo :message => 'Hello world!'
end
end
# $ jruby build.rb
# > hello: