Skip to content

Instantly share code, notes, and snippets.

View gary's full-sized avatar
🌐
Working from home

Gary Iams gary

🌐
Working from home
View GitHub Profile
# by bryan helmkamp with slight modification by chris wanstrath
# from http://www.brynary.com/2008/8/3/our-git-deployment-workflow
# I DO NOT RECOMMEND USING THIS WORKFLOW - IT DESTROYS HISTORY! - jesse andrews
module GitCommands
extend self
def diff_staging
`git fetch`
# Git Sub-Trees Sake Tasks
# http://rubyurl.com/BwnY < - Read about the technique vs submodules
#
# This works super good with Rails plugins or when you are actively working
# on two related projects.
#
# Add these tasks with:
# sake -i http://pastie.caboo.se/213492.rb
#
# Example Usage:
;;; Key Bindings -----------------------------------------------------
match(:first_subdomain => ":subdomain").namespace('newspapers') do |sd|
sd.match('/').to(:controller => :first_subdomain, :action => 'index')
end
match('/').to(:controller => 'basic_newspaper', :action => 'index')
match(:subdomain => /(\w+)/).to(:namespace => 'newspapers') do |sd|
sd.match('/').to(:controller => ':subdomain[1]', :action => 'index')
end
match('/').to(:controller => 'basic_newspaper', :action => 'index')
namespace :db do
desc "Bootstrap the application, readying it for use."
task :bootstrap => ['db:schema:load',
'db:users:create_admin',
'db:users:create_user'] do
puts "* #{configatron.name} bootstrap process complete."
end
namespace :users do
[ebuild N ] dev-libs/apr-1.3.2 USE="-debug -doc -urandom"
[ebuild N ] app-misc/mime-types-7
[ebuild N ] app-admin/php-toolkit-1.0.1
[ebuild U ] dev-libs/libpcre-7.8 [7.7-r1]
[ebuild N ] dev-libs/libmcrypt-2.5.8
[ebuild N ] app-admin/webapp-config-1.50.16-r1
[ebuild N ] dev-libs/apr-util-1.3.2 USE="berkdb gdbm -doc -freetds -ldap -mysql -odbc -postgres -sqlite -sqlite3"
[ebuild N ] dev-lang/php-5.2.8-r1 USE="berkdb bzip2 cli crypt gdbm iconv ipv6 ncurses nls pcre readline reflection session spl ssl unicode zlib -adabas -apache2 -bcmath -birdstep -calendar -cdb -cgi -cjk -concurrentmodphp -ctype -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd -gd-external -gmp -hash -imap -inifile -interbase -iodbc (-java-external) -json -kerberos -kolab -ldap -ldap-sasl -libedit -mcve -mhash -msql -mssql -mysql -mysqli -oci8 -oci8-instan
= form_for @subscription, :action => url(:create_mobile_alert_subscription), :method => 'post' do
= partial subscription_for_mobile_alert(@mobile_alert), :with => @subscription
namespace(:mobile_edition, :name_prefix => 'topic', :namespace => 'topics') do
match('/subscriptions/edit/:id').
to(:controller => 'subscriptions', :action => :edit).
name(:edit, :subscription)
match('/subscriptions/update').
to(:controller => 'subscriptions', :action => :update).
name(:update, :subscription)
end
# make life in JavaScript more readable by wrapping the Objects needed
# to update after a {successful,failed} save in a named Hash, which will
# serialize an Object with key-named properties. big slick.
def pretty_json(subscription, params={})
# camelCased ruby is heresy, and is merely following the naming
# conventions of its destination environment
if subscription.valid?
{ :newspaperName => @mobile_alert.newspaper.name,
:mobileAlert => @mobile_alert,
:editLink => edit_subscription_modal_window(@mobile_alert.id,