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
# Q&D Rails Profiling | |
# Credit Dan Mange: http://www.dcmanges.com/blog/rails-performance-tuning-workflow | |
require "ruby-prof" | |
class ApplicationController < ActionController::Base | |
around_filter :profile | |
def profile | |
return yield if params[:profile].nil? | |
result = RubyProf.profile { yield } | |
printer = RubyProf::GraphPrinter.new(result) |
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 parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
function check_git_changes { | |
var=`git status 2> /dev/null | sed -e '/(working directory clean)$/!d' | wc -l` | |
if [ $var -ne 1 ]; then | |
tput setaf 1 # red | |
else | |
tput setaf 2 # green | |
fi |
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
Install gettext: | |
http://ftp.gnu.org/pub/gnu/gettext/gettext-0.17.tar.gz | |
$ configure && make | |
$ sudo make install | |
Install glib 2.18 | |
http://ftp.gnome.org/pub/gnome/sources/glib/2.18/glib-2.18.0.tar.gz | |
$ configure && make | |
$ sudo rm -rf /usr/local/include/glib.h /usr/local/include/gmodule.h | |
$ sudo make install |
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
module Configuration | |
States = {"AA"=>"Armed Forces Americas", "VA"=>"Virginia", "ND"=>"North Dakota", "NY"=>"New York", "AL"=>"Alabama", "RI"=>"Rhode Island", "NE"=>"Nebraska", "MN"=>"Minnesota", "MD"=>"Maryland", "HI"=>"Hawaii", "DE"=>"Delaware", "CO"=>"Colorado", "WY"=>"Wyoming", "PR"=>"Puerto Rico", "MO"=>"Missouri", "ME"=>"Maine", "IA"=>"Iowa", "OR"=>"Oregon", "OH"=>"Ohio", "MP"=>"Northern Mariana Islands", "KY"=>"Kentucky", "IL"=>"Illinois", "GU"=>"Guam", "AZ"=>"Arizona", "AP"=>"Armed Forces Pacific", "AE"=>"Armed Forces Middle East", "TX"=>"Texas", "TN"=>"Tennessee", "NH"=>"New Hampshire", "GA"=>"Georgia", "SC"=>"South Carolina", "MH"=>"Marshall Islands", "IN"=>"Indiana", "ID"=>"Idaho", "SD"=>"South Dakota", "PA"=>"Pennsylvania", "OK"=>"Oklahoma", "NJ"=>"New Jersey", "MS"=>"Mississippi", "MI"=>"Michigan", "FL"=>"Florida", "CT"=>"Connecticut", "AR"=>"Arkansas", "WI"=>"Wisconsin", "PW"=>"Palau", "MT"=>"Montana", "FM"=>"Federated States of Micronesia", "AS"=>"American Samoa", "VI"=>"Virgin Islands", "VT" |
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
require 'rubygems' | |
require 'growl' #visionmedia-growl | |
require 'nokogiri' | |
require 'open-uri' | |
while true | |
doc = Nokogiri::HTML(%x[curl -A 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_8; en-us) AppleWebKit/532.0+ (KHTML, like Gecko) Version/4.0.3 Safari/531.9.2009' http://store.apple.com/us]) | |
if doc.xpath('//img[@alt="We\'ll be back soon"]').size == 0 | |
Growl.notify { |
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
/usr/local brew install git | |
==> Downloading http://kernel.org/pub/software/scm/git/git-1.6.6.1.tar.bz2 | |
File already downloaded and cached to /Users/kevinsmith/Library/Caches/Homebrew | |
==> make prefix=/usr/local/Cellar/git/1.6.6.1 install | |
GIT_VERSION = 1.6.6.1 | |
* new build flags or prefix | |
GEN git-am | |
GEN git-bisect | |
GEN git-difftool--helper | |
GEN git-filter-branch |
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
=begin | |
From http://jonkinney.com/articles/2010/04/21/using-save_and_open_page-to-open-failed-cucumber-scenerios-in-a-browser-with-images-and-css/ | |
I chose to put this code in a file under the features/support directory called: open_browser_on_fail.rb. If it's sitting next to the env.rb file itself then you have the new file in the right place. | |
Place the following code in that file and you'll be good to go! | |
=end | |
After do |scenario| | |
if scenario.status == :failed | |
save_and_open_page | |
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
require 'rubygems' | |
require 'carrierwave' | |
require 'fileutils' | |
# needed for the RMagick module in CarrierWave | |
def current_path | |
@current_path | |
end | |
include CarrierWave::RMagick |
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
# run from a command line to get the access token information | |
require 'rubygems' | |
require 'oauth' | |
@consumer_key = "YOUR_CONSUMER_KEY" | |
@consumer_secret = "YOUR_CONSUMER_SECRET" | |
@consumer = OAuth::Consumer.new(@consumer_key, @consumer_secret, { | |
:site => "http://api.awesomeapp.com" # example: "http://api.twitter.com" |
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
PROJECT_NAME = "Awesome" # the name of your xcode project | |
APP_NAME = "Awesome" # whatever your app name is | |
@configuration = "Release" # xcode project configuration to use | |
@app_suffix = "-Staging" | |
SDK_VERSION = "5.1" | |
SDK_DIR = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator#{SDK_VERSION}.sdk" | |
BUILD_DIR = File.join(File.dirname(__FILE__), "build") | |
TESTFLIGHT_API_TOKEN = "TESTFLIGHT_API_TOKEN" |
OlderNewer