Skip to content

Instantly share code, notes, and snippets.

View priceflex's full-sized avatar

Steven Price priceflex

View GitHub Profile
@priceflex
priceflex / gist:2633211
Created May 8, 2012 07:06
A nice way to organize your spec_helper file
ENV["RAILS_ENV"] ||= 'test'
# begin
# require 'rubygems'
# require 'spork'
# rescue LoadError => e
# end
def load_all(*patterns)
patterns.each { |pattern| Dir[pattern].sort.each { |path| load File.expand_path(path) } }
@priceflex
priceflex / rails31init.md
Created April 15, 2012 07:52 — forked from samnang/rails31init.md
Rails 3.1 with Rspec, Factory Girl, Haml, Simple Form, Database Cleaner, Spork, and Guard

Install Rails 3.1

gem install rails

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@priceflex
priceflex / gist:1625638
Created January 17, 2012 08:25
Rake task to dump and load databases in rails
namespace :db do
desc "create db copy file"
task :sgl_dump => :environment do
system "cp #{Rails.root}/db/development.sqlite3 #{Rails.root}/db/#{Date.today.to_s.split('-').join}-devdb"
end
desc "load latest db file"
task :sgl_load => :environment do
puts "Are you sure you want over write your database? YES/NO"
yn = STDIN.gets
@priceflex
priceflex / pairprogramming.screenrc
Created November 15, 2011 07:25 — forked from ramontayag/pairprogramming.screenrc
.screenrc setting for remote pairing
multiuser on
acladd user1,user2,user3
vbell off
hardstatus string "%1`"
# change the hardstatus settings to give an window list at the bottom of
# the screen, with the time and date and with the current window highlighted
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
@priceflex
priceflex / gist:1037315
Created June 21, 2011 05:55
EZ Clean Dynamic rails navigation.
module ApplicationHelper
# Simple Navigation
# navigation nav_elements, :selected_class => "foo"
def navigation(links=[],options={})
path = (options[:controller_only] == true) ? controller.controller_name.to_sym : request.path
content_tag :ul, :class => (options[:class] || 'navigation') do
links.each do |link|
klass = (path == link[:path]) ? options[:selected_class] || 'current' : ""