Skip to content

Instantly share code, notes, and snippets.

View carols10cents's full-sized avatar

Carol (Nichols || Goulding) carols10cents

View GitHub Profile
require "rubygems"
require "builder"
class Roster
def initialize
@members = []
@members_cache = []
@content = nil
end
# Pattern: Replace exception with test
class PreRefactoringRoster
def initialize
@members = []
end
attr_reader :members
def add_user(name)
require 'bundler'
Bundler.setup
Bundler.require(:default)
require_relative '../lib/munin-graph' # This is in ../lib
require 'munin_graph_server'
run Sinatra::Application
@carols10cents
carols10cents / oss.txt
Created September 1, 2011 23:12
Open Source Notes
Contributing to Open Source
===========================
First Rule: You can find the time
- It doesn't take much
- Weekends are good
- Find what other time you're wasting
- Try something that's _not_ your day job
Second Rule: What to contribute to?
@carols10cents
carols10cents / gist:1262342
Created October 4, 2011 18:08 — forked from colindean/gist:1261980
test generator failing
# Try this (minispec):
describe "not logged in" do
[:index, :new].each do |method|
it "should redirect to login on #{method}" do
get method
assert_redirect_to login_url
end
end
end
@carols10cents
carols10cents / http.rb
Created April 6, 2012 00:33 — forked from steveklabnik/http.rb
A Shoes hypermedia client for ALPS microblogging
require 'net/http'
require 'open-uri'
require 'hpricot'
# A simple get request should not require this much boilerplate.
def fetch_data(uri)
uri = URI(uri)
req = Net::HTTP::Get.new(uri.request_uri)
req['Accept'] = "application/xhtml+xml"
@carols10cents
carols10cents / http.rb
Created May 8, 2012 23:55 — forked from steveklabnik/http.rb
A Shoes hypermedia client for ALPS microblogging
require 'net/http'
require 'open-uri'
require 'hpricot'
# A simple get request should not require this much boilerplate.
def fetch_data(uri)
uri = URI(uri)
req = Net::HTTP::Get.new(uri.request_uri)
req['Accept'] = "application/xhtml+xml"
- line_item.ordered_values.each do |val|
"blah"
@carols10cents
carols10cents / playground.rs
Created October 28, 2015 00:33 — forked from anonymous/playground.rs
Shared via Rust Playground
fn main() {
// I don't want this to have to be mut.
let v = vec![1, 2, 3];
// Not this either.
let w = vec![3, 4, 5];
// I want a newly allocated vec that is v + w.
let x = vec_concat(&v, &w);
println!("{:?}", x);
@carols10cents
carols10cents / playground.rs
Last active October 30, 2015 18:48 — forked from anonymous/playground.rs
fizzbuzz to illustrate conditionals
// Make these tests pass by filling in conditionals where the blanks currently are!
// Scroll down for hints :)
pub fn fizz_buzz(i: i32) -> String {
__________ {
"FizzBuzz".to_string()
} ___________ {
"Fizz".to_string()
} ___________ {
"Buzz".to_string()