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
curl -o latest.dump `heroku pgbackups:url` | |
rake db:drop db:create db:migrate | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U root -d DATABASE_development latest.dump | |
rm latest.dump |
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
# Useage: select2("value to select", from: "label text") | |
module Capybara | |
module Select2 | |
def select2(value, options={}) | |
select_name = options[:from] | |
select2_container = first("label", text: select_name).find(:xpath, "..").find(".select2-container") | |
select2_container.find(".select2-choice").click | |
find(:xpath, "//body").find(".select2-drop li", text: value).click | |
end |
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
class UploaderInput < Formtastic::Inputs::FileInput | |
MAX_WIDTH_PIXELS = 300 | |
MAX_HEIGHT_PIXELS = 200 | |
def to_html | |
input_wrapping do | |
html_array = [] | |
html_array << label_html | |
html_array << cache_html if method_changed? | |
html_array << file_html |
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
function ember-cli-update { | |
if [ -z "$1" ]; then | |
echo "$(tput setaf 1)No Ember CLI version has been specified. Example: ember-cli-update 0.1.7$(tput sgr 0)" | |
return 1 | |
fi | |
echo "$(tput setaf 2)Uninstalling global Ember CLI...$(tput sgr 0)" | |
npm uninstall -g ember-cli | |
echo "$(tput setaf 2)Cleaning NPM and Bower cache...$(tput sgr 0)" |
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
# Get this working in an initializer... | |
%w(zipcode, city, designated_market_area, core_based_statistical_area).each do |t| | |
Zips::<t's classified name here>.set_schema("") | |
Zips::<t's classified name here>.set_table_name("zips_#{t.pluralize}") | |
end |
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
%w[rubygems wirble pp ap].each do |gem_name| | |
begin | |
require gem_name | |
rescue LoadError => err | |
warn "Please do: gem install #{gem_name.sub(/\/.*/,'')}" | |
end | |
end | |
Wirble.init | |
Wirble.colorize |
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
File: | |
!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$ | |
Folder: | |
!.*/(\.[^/]*|doc|log|solr|public/uploads|public/system|tmp|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$ |
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
# Debugging with POW! | |
# | |
# Setup POW!'s ~/.powconfig with the following: | |
# export POW_WORKERS=1 | |
# export POW_TIMEOUT=3600 | |
# | |
# Run `bundle exec rdebug -c` in the Terminal to start the debugger | |
if (Rails.env.development? || Rails.env.test?) && !(defined?($rails_rake_task) && $rails_rake_task) | |
puts "=> Debugger enabled" |
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
# New | |
range :percentile, from: percentile[0], to: 1 | |
# Old | |
range :percentile, :from => percentile[0], :to => 1 |
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
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/ | |
# added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com) | |
# clearly this could be cleaner, but it does work | |
require 'rack' | |
require 'rack-legacy' | |
require 'rack-rewrite' | |
# patch Php from rack-legacy to substitute the original request so | |
# WP's redirect_canonical doesn't do an infinite redirect of / |
OlderNewer