Skip to content

Instantly share code, notes, and snippets.

View bry4n's full-sized avatar
🤘
Retired

bry4n

🤘
Retired
  • Internet
View GitHub Profile
# 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.
@bry4n
bry4n / app.rb
Created January 19, 2010 13:12 — forked from stephencelis/app.rb
# 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"
# 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.)
@bry4n
bry4n / gitrun.sh
Created February 11, 2010 03:36
quickly testing the ruby code from Github Gist
#!/bin/sh
#
# quickly testing the ruby code from Github Gist with curl
#
# Usage : gistrun <GIST #>
# Example : gistrun 271066
#
# bry4n
set -e
@bry4n
bry4n / mini.rb
Created February 19, 2010 00:48 — forked from defunkt/mini.rb
##
# 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)
#!/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'
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)
@bry4n
bry4n / gemspec
Created May 14, 2010 03:05 — forked from defunkt/gemspec
#!/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:
#
@bry4n
bry4n / Gemfile
Created November 1, 2010 16:42
Simple DSL web scraper using Nibbler + Nokogiri + Faraday (less 35 LOC)
source :rubygems
gem 'nokogiri'
gem 'faraday'
gem 'nibbler'
@bry4n
bry4n / gist:959681
Created May 6, 2011 20:04 — forked from schacon/gist:1
the meaning of gist
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.