This file contains hidden or 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
| set :slice3, '72.46.232.204:7005' | |
| set :slice1, '72.46.232.204:7009' | |
| set :slice2, '72.46.232.204:7012' | |
| set :slice4, '72.46.232.204:7002' | |
| set :slice5, '72.46.232.204:7003' | |
| set :slice6, '72.46.232.204:7004' | |
| set :slice7, '72.46.232.204:7006' | |
| set :slice8, '72.46.232.204:7010' | |
| set :slice9, '72.46.232.204:7013' | |
| set :slice10, '72.46.232.204:7007' |
This file contains hidden or 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 Hash | |
| def without *args | |
| reject { |key, val| args.include? key } | |
| end | |
| end | |
| h = { :one => 1, :two => 2, :three => 3 } | |
| h.without :one | |
| #=> { :two => 2, :three => 3 } |
This file contains hidden or 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 App::Controllers::MobileSupport | |
| def self.included(base) | |
| base.send :before_filter, :redirect_to_appropriate_site | |
| base.send :helper_method, :iphone_request? | |
| base.send :helper_method, :touch_request? | |
| end | |
| def redirect_to_appropriate_site | |
| if on_touch_site? and requesting_full_site? |
This file contains hidden or 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/bin/ruby | |
| # | |
| # I deliberately didn't DRY /usr/local references into a variable as this | |
| # script will not "just work" if you change the destination directory. However | |
| # please feel free to fork it and make that possible. | |
| # | |
| # If you do fork, please ensure you add a comment here that explains what the | |
| # changes are intended to do and how well you tested them. | |
| # | |
| # 30th March 2010: |
This file contains hidden or 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
| zoom() { | |
| if [ -z $1 ]; then | |
| echo "usage: $FUNCNAME ApplicationName" | |
| else | |
| osascript -e "tell application \"$1\" to set zoomed of window 1 to not (zoomed of window 1)" 2>&1 >/dev/null | |
| fi | |
| } | |
| alias mysite="cd ~/Sites/mysite.com && mate app/ config/ features/ public/ spec/ && zoom TextMate" |
This file contains hidden or 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
| Date.prototype.beginningOfWeek = function (startOfWeek) { | |
| startOfWeek = startOfWeek || 0; | |
| return new Date( this - ( (this.getDay() - startOfWeek) * 86400000) ); | |
| } |
This file contains hidden or 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 Hash | |
| def map_values(&block) | |
| Hash[*self.map{ |i| i[1] = yield(i[1]); i }.flatten] | |
| end | |
| end | |
| [ 'asdf', 'qwer' ].map{ |val| val * 2 } | |
| # => [ 'asdfasdf', 'qwerqwer' ] | |
| { :one => 'asdf', :two => 'qwer' }.map{ |val| val * 2 } |