###1xx Informational
| code | message | symbol |
|---|---|---|
| 100 | Continue | :continue |
| 101 | Switching Protocols | :switching_protocols |
| 102 | Processing | :processing |
###2xx Success
| module ApplicationHelper | |
| def smart_truncate(s, opts = {}) | |
| opts = {:words => 12}.merge(opts) | |
| if opts[:sentences] | |
| return s.split(/\./)[0, opts[:sentences]].map{|s| s.strip}.join('. ') + '.' | |
| end | |
| a = s.split(/\s/) # or /[ ]+/ to only split on spaces | |
| n = opts[:words] | |
| a[0...n].join(' ') + (a.size > n ? '...' : '') |
| # Useful regular expressions | |
| # http://net.tutsplus.com/tutorials/other/8-regular-expressions-you-should-know/ | |
| # username | |
| /^[a-z0-9_-]{3,16}$/ | |
| # password | |
| /^[a-z0-9_-]{6,18}$/ | |
| # Hex value |
| function rake { | |
| if [ -e Gemfile ]; then | |
| bundle exec rake $@ | |
| else | |
| `which rake` $@ | |
| fi | |
| } | |
| function rspec { | |
| if [ -e Gemfile ]; then |
| #!/usr/bin/env ruby | |
| # Pow Port | |
| # | |
| # Quickly and easily change the port that Pow is running on. This allows | |
| # you too run Apache and Pow side-by-side (on different ports of course). | |
| # | |
| # WARNING: This will OVERWRITE your ~/.powconfig file. If you have custom | |
| # configurations in there, please back it up first. | |
| # |
| # http://guides.rubygems.org/command-reference/#gem-environment | |
| --- | |
| gem: --no-ri --no-rdoc | |
| benchmark: false | |
| verbose: true | |
| update_sources: true | |
| backtrace: true | |
| bulk_threshold: 1000 |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| # http://guides.rubygems.org/command-reference/#gem-environment | |
| --- | |
| gem: --no-ri --no-rdoc | |
| benchmark: false | |
| verbose: true | |
| update_sources: true | |
| backtrace: true | |
| bulk_threshold: 1000 |
| // The basic check | |
| if(document.readyState === 'complete') { | |
| // good to go! | |
| } | |
| // Polling for the sake of my intern tests | |
| var interval = setInterval(function() { | |
| if(document.readyState === 'complete') { | |
| clearInterval(interval); | |
| done(); |
| git config --global diff.tool diffmerge | |
| git config --global difftool.diffmerge.cmd 'diffmerge "$LOCAL" "$REMOTE"' | |
| git config --global merge.tool diffmerge | |
| git config --global mergetool.diffmerge.cmd 'diffmerge --merge --result="$MERGED" "$LOCAL" "$(if test -f "$BASE"; then echo "$BASE"; else echo "$LOCAL"; fi)" "$REMOTE"' | |
| git config --global mergetool.diffmerge.trustExitCode true |
###1xx Informational
| code | message | symbol |
|---|---|---|
| 100 | Continue | :continue |
| 101 | Switching Protocols | :switching_protocols |
| 102 | Processing | :processing |
###2xx Success