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
| # zsh functions to grab the current ruby version info from RVM. | |
| # Useful mainly in prompts (see http://skitch.com/oshuma/nni3k/zsh-prompt-git-clean). | |
| # ~/.zshrc | |
| # RPS1=$'Ruby v$(ruby_prompt_version)' | |
| # Ruby Version Manager | |
| if [ -s ~/.rvm/scripts/rvm ] ; then | |
| source ~/.rvm/scripts/rvm |
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
| # ---------------------- | |
| # variables | |
| # ---------------------- | |
| PATH="$PATH:/opt/local/bin:/opt/local/sbin:/usr/games:/usr/local/mysql/bin:/usr/local/sbin" | |
| MANPATH="$MANPATH:/opt/local/man" | |
| IRB_HISTORY_FILE=$HOME/.irb_history | |
| LESS='-M -R -X' | |
| # ---------------------- |
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
| $ ./script/console | |
| Loading development environment (Rails 2.1.1) | |
| >> Rails.env | |
| => "test" | |
| $ ./script/console development | |
| Loading development environment (Rails 2.1.1) | |
| >> Rails.env | |
| => "test" |
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
| $ macgem list | |
| *** LOCAL GEMS *** | |
| bacon (1.1.0) | |
| httpattack-lib (0.2.1) | |
| $ macirb | |
| irb(main):001:0> require 'rubygems' | |
| => false |
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
| { | |
| :Base => 'app_config/base', | |
| :Error => 'app_config/error', | |
| :Storage => 'app_config/storage' | |
| }.each_pair { |name, file| autoload name, file } |
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
| # Run me with: | |
| # | |
| # $ watchr specs.watchr.rb | |
| # -------------------------------------------------- | |
| # Convenience Methods | |
| # -------------------------------------------------- | |
| def all_test_files | |
| Dir['test/**/*_test.rb'] - ['test/test_helper.rb'] | |
| end |
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 App < Sinatra::Base | |
| def initialize(url = '/some/url') | |
| @url = url | |
| end | |
| get "#{@url}/?" do | |
| # Doesn't match the URL. | |
| end | |
| end |
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
| # include this in application controller | |
| module Authentication | |
| protected | |
| # Inclusion hook to make #current_user and #signed_in? | |
| # available as ActionView helper methods. | |
| def self.included(base) | |
| base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method | |
| end | |
| # Returns true or false if the user is signed in. |
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
| development: &default_settings | |
| database: APPNAME_development | |
| host: 127.0.0.1 | |
| port: 27017 | |
| test: | |
| <<: *default_settings | |
| database: APPNAME_test | |
| production: |
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
| curl "http://en.wikipedia.org/wiki/Pipeline_(Unix)" | \ | |
| sed 's/[^a-zA-Z ]/ /g' | \ | |
| tr 'A-Z ' 'a-z\n' | \ | |
| grep '[a-z]' | \ | |
| sort -u | \ | |
| comm -23 - /usr/share/dict/words | \ | |
| while read line; do | |
| echo Not Found: $line | |
| done |