Skip to content

Instantly share code, notes, and snippets.

View priceflex's full-sized avatar

Steven Price priceflex

View GitHub Profile
@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' : ""
@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: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 / 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: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 / chef_solo_bootstrap.sh
Created May 13, 2012 21:45 — forked from rizwanreza/chef_solo_bootstrap.sh
Bootstrap Chef Solo - EC2
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@priceflex
priceflex / .vimrc
Created May 31, 2012 03:43
My vimrc file
map <C-t> :CommandT<CR>
set number
set showcmd
set background=dark
map <Esc>[A <Up>
map <Esc>[B <Down>
map <Esc>[C <Right>
map <Esc>[D <Left>
syntax on
@priceflex
priceflex / deploy.rb
Created June 23, 2012 18:34 — forked from geekontheway/deploy.rb
capistrano-with-passenger-stand-alone
# -*- encoding : utf-8 -*-
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_ruby_string, '1.9.2' # Or whatever env you want it to run in.
require 'bundler/capistrano'
set :application, "yourapp"
set :use_sudo, false
setx PATH "%PATH%;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin\;" /M
Disable-MicrosoftUpdate
Disable-UAC
Update-ExecutionPolicy Unrestricted
cinst git.install
cinst ruby
cinst powershell
cinst chef-client
cinst putty
cinst rubygems