This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Factory girl, relaxed. | |
# | |
# Factory.define :user do |f| | |
# f.login 'johndoe%d' # Sequence. | |
# f.email '%{login}@example.com' # Interpolate. | |
# f.password f.password_confirmation('foobar') # Chain. | |
# end | |
# | |
# Factory.define :post do |f| | |
# f.user { Factory :user } # Blocks, if you must. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define application-level configuration using a simple DSL. | |
# | |
# class App < Configuration | |
# config.key = "value" | |
# config.lazy = lambda { |load| load } | |
# end | |
# | |
# App.key # => "value" | |
# App.key? # => true | |
# App.lazy("load") # => "load" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hey coops.. | |
# | |
# Imagine yourself on the other side of the table: two job openings, hundreds of resumes, | |
# _all of which_ look friggin' identical. Yeah, the HR departments at your MegaCorp XYZ are using | |
# automated tools to scan for keywords, and the coop department at your school is trying to beat | |
# you into submission to follow some "predefined template".. But, unless what you're aspiring to | |
# is to be an automaton at MegaCorp XYZ, relegated to writing test harnesses for code that will | |
# never see the light of day.. please do yourself a favor, and _be different_! Be bold, dammit. | |
# | |
# (Frankly, I'm falling asleep while reading your resumes.. Wake me up! Srsly.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# quickly testing the ruby code from Github Gist with curl | |
# | |
# Usage : gistrun <GIST #> | |
# Example : gistrun 271066 | |
# | |
# bry4n | |
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# test/spec/mini 5 | |
# http://gist.github.com/307649 | |
# chris@ozmm.org | |
# | |
def context(*args, &block) | |
return super unless (name = args.first) && block | |
require 'test/unit' | |
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do | |
def self.test(name, &block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Run Rspec-rails automatically with FSevent (like alloy's kicker, but using ruby-fsevent) | |
# Setup: | |
# 1) sudo cp autospec.rb /usr/local/bin/autospec | |
# 2) sudo chmod +x /usr/local/bin/autospec | |
# 3) cd /to/your/rails | |
# 4) autospec | |
begin | |
require 'fsevent' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user system total real | |
unless 0.520000 0.150000 0.670000 ( 0.677782) | |
if not 0.520000 0.150000 0.670000 ( 0.672080) | |
if ! 0.520000 0.180000 0.700000 ( 0.691658) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Usage: gemspec [-s] GEMNAME | |
# | |
# Prints a basic gemspec for GEMNAME based on your git-config info. | |
# If -s is passed, saves it as a GEMNAME.gemspec in the current | |
# directory. Otherwise prints to standard output. | |
# | |
# Once you check this gemspec into your project, releasing a new gem | |
# is dead simple: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem 'nokogiri' | |
gem 'faraday' | |
gem 'nibbler' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
Without gist, I am useless. |
OlderNewer