Skip to content

Instantly share code, notes, and snippets.

View calebhaye's full-sized avatar

Caleb Adam Haye calebhaye

View GitHub Profile
@calebhaye
calebhaye / .gems
Created April 21, 2012 07:13 — forked from rmanalan/.gems
Static websites using Heroku
rack-contrib
rack-rewrite
@calebhaye
calebhaye / gist:3726057
Created September 15, 2012 02:09
Sample Textile
h2{color:green}. This is a title
h3. This is a subhead
p{color:red}. This is some text of dubious character. Isn't the use of "quotes" just lazy writing -- and theft of 'intellectual property' besides? I think the time has come to see a block quote.
bq[fr]. This is a block quote. I'll admit it's not the most exciting block quote ever devised.
Simple list:
@calebhaye
calebhaye / pdf_helper.rb
Created October 24, 2012 17:23
Generating PDFs with wicked_pdf
module PdfHelper
require 'wicked_pdf'
def self.included(base)
base.class_eval do
alias_method_chain :render, :wicked_pdf
end
end
def render_with_wicked_pdf(options = nil, *args, &block)
@calebhaye
calebhaye / extract_fixtures.rake
Created January 8, 2013 07:01
Create YAML test fixtures from data in an existing database.
desc 'Create YAML test fixtures from data in an existing database.
Defaults to development database. Set RAILS_ENV to override.'
task :extract_fixtures => :environment do
sql = "SELECT * FROM %s"
skip_tables = ["schema_info"]
ActiveRecord::Base.establish_connection
(ActiveRecord::Base.connection.tables - skip_tables).each do |table_name|
i = "000"
File.open("#{Rails.root}/test/fixtures/#{table_name}.yml", 'w') do |file|
# see - http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html
# get latest from master
git pull origin master
# set "current feature" variable and create feature branch
export CURRENT_FEATURE=1234567-feature-name
git checkout -b $CURRENT_FEATURE
# or use the following to get the current branch name
CURRENT_FEATURE=$(git symbolic-ref -q HEAD)
CURRENT_FEATURE=${CURRENT_FEATURE##refs/heads/}
CURRENT_FEATURE=${CURRENT_FEATURE:-HEAD}
Resque.workers.each {|w| w.unregister_worker }

Twitter Bootstrap Components Helper

Provides an accordion helper and a tabs helper

In your Gemfile:

gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/5105757.git'

Accordion helper:

@calebhaye
calebhaye / gist:7830604
Created December 6, 2013 19:20
Create Pow! app from current directory
POWAPP=`pwd`; cd ~/.pow/; ln -s $POWAPP; cd -
@calebhaye
calebhaye / pre-push
Created February 27, 2014 19:55
Run tests before git push
#!/bin/sh
branch=`git rev-parse --abbrev-ref HEAD`
echo "Running tests before pushing ...."
if [ $branch == 'master' ]; then
exit_code=$(bundle exec rake > /dev/null 2>/dev/null )$?
if [ $exit_code -gt 0 ]
then echo "Did not push because of failing tests"
fi
exit $exit_code