Skip to content

Instantly share code, notes, and snippets.

View wpeterson's full-sized avatar

Winfield Peterson wpeterson

View GitHub Profile
git checkout develop # all developer work is off of this branch
git pull --rebase # make sure local develop is up-to-date (can this be git rebase?)
git checkout -b my-nifty-feature-559876 # create your feature branch; I like to put Pivotal story ID in it for convenience; not required
# do your work, make sure all tests still pass, etc. COMMIT FREQUENTLY
git commit -m "First part of my nifty feature working; now on to the back-end."
# fetch latest remote develop and rebase your local feature branch on this.
git fetch
git rebase origin/develop
# Local feature branch now has latest origin/develop code as base

How to Fix Unread Favicon in GMail for Chrome

  • Ensure Labs => Unread Message Icon feature enabled
  • Install "TamperMonkey" chrome plugin
  • Add the javascript included in this gist (fix_gmail_unread_favicon.js)

Thanks to Bertrand Schneider for the code snippet and fix.

Why did the favicon break?

@wpeterson
wpeterson / git_capistrano_tasks.rb
Created February 7, 2013 20:26
Useful capistrano tasks for git cache_copy maintenance
namespace :git do
desc "Prune remote git cached copy (fixes errors with deleted branches)"
task :prune do
repository_cache = File.join(shared_path, 'cached-copy')
logger.info "Pruning origin in remote cached-copy..."
run "cd #{repository_cache}; git remote prune origin"
end
desc "Clear Capistrano Git cached-copy"
task :clear_cache do
class CoercedValueValidator < ActiveModel::Validator
def validate(record)
coercible_attrs = record.keys.select { |k,v| [Integer, Float, Date, Time].include?(v.type) }.map(&:first)
coercible_attrs.each do |attr|
record.errors.add(attr, 'is invalid') if record.send("#{attr}_before_type_cast").present? && record.send(attr).nil?
end
end
end
@wpeterson
wpeterson / ruby-193-p327-falcon_deb.sh
Created December 6, 2012 00:41 — forked from johnbintz/gist:2965472
ruby 1.9.3-p327 with performance patches built into a .deb package with fpm
# For Debian Squeeze
# Part 1: Make a deb package of ruby:
# Get our deps
sudo apt-get update
sudo apt-get install -y python-setuptools python-dev build-essential dpkg-dev libopenssl-ruby ruby1.8-dev rubygems bison autoconf zlib1g zlib1g-dev libreadline6 libreadline6-dev libssl0.9.8 libssl-dev libyaml-dev
# Get ruby
curl -O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
tar -zxvf ruby-1.9.3-p327.tar.gz
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/data/server/shared/bundle/ruby/1.9.1/bin:/Users/web-user/.rvm/gems/ruby-1.9.2-p180@katama_server/bin:/Users/web-user/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/web-user/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/web-user/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:$PATH"
builtin-productPackagingUtility /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/Entitlements.plist -entitlements -format xml -o /var/folders/bd/hk27x3wj4jq5sl__cq4c_1lc0000gv/T/50532bbe8bd94b0215002e49/1348682935/IOS/build/IOSContainer.build/Release-iphoneos/IOSContainerRelease.build/test.xcent
CodeSign build/Release-iphoneos/test.app
cd /var/folders/bd/hk27x3wj4jq5sl__cq4c_1lc0000gv/T/50532bbe8bd94b0215002e49/1348682935/IOS
@wpeterson
wpeterson / gist:1278721
Created October 11, 2011 17:15 — forked from javan/gist:1168475
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@wpeterson
wpeterson / 057_estimates.txt
Created May 11, 2011 14:56
Friday Estimation pre-057
Condition primary-ness should be enforced at the model level - Michael
Find closed clinical trials - Keenan
Improving results on who is eligible link from CTA show page - Jeffrey
Show misdiagnoses in a separate way from resolved conditions - Mav
Human readable database - Michael
Allow different lab intervals for different conditions - Brett
Blood pressure + FVC should be listed under labs and tests in condition admin tool - Brett
Allow non-members to sign up for newsletters - Chris B.
Improvements to admin redirector tool - Joe
Style changes to reminder emails - Cris
# Filename: RAILS_ROOT/config/initializers/paperclip_thumbnail_with_dimensions.rb
# Required Configuration in the model
#
# include Paperclip::Dimensions
#
# has_attached_file :image,
# :styles => {
# :thumbnail => {
# :geometry => "100x100>",
# :format => :png
@wpeterson
wpeterson / cache_segmentation_environment.rb
Created November 23, 2010 23:43
Example of Segmenting Caches in Rails Apps
revision_file = Rails.root.join('REVISION')
if File.exist?(revision_file)
revision = File.read(revision_file).match /[a-f,0-9]{6}$/
end
config.cache_store = :mem_cache_store, memcache_host, {
:namespace => "volatile-#{ revision ? revision[0] : '0'}"
}
config.action_controller.cache_store = :mem_cache_store, memcache_host, {
:namespace => 'stable'
}