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
| Last login: Fri Aug 19 15:43:53 on ttys006 | |
| You have new mail. | |
| Fri Aug 19 15:44:57 brookr@pridwen.local:~ > ruby -v | |
| ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0] | |
| Fri Aug 19 15:44:59 brookr@pridwen.local:~ > rvm list | |
| rvm rubies | |
| Fri Aug 19 15:45:03 brookr@pridwen.local:~ > rvm install 1.9.2 |
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
| # Does it have substance? Use .blank? or .present?, it's opposite: | |
| >> " ".blank? | |
| => true | |
| >> nil.blank? | |
| => true | |
| >> [].blank? | |
| => true | |
| >> nil.present? | |
| => false | |
| >> [].present? |
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
| var Card = { | |
| isValid: function(strum) { | |
| var sum = 0, mul = 1, length = strum.length, digit, tproduct | |
| forEach(c in strum.slice(0,17)) { | |
| digit = CC.substring(length-i-1,length-i); | |
| tproduct = parseInt(digit ,10)*mul; | |
| sum += (tproduct >= 10 ? (tproduct % 10) + 1 : tproduct) | |
| mul += (mul == 1 ? 1 : -1) | |
| } |
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
| var countdown = function() { | |
| var index; | |
| function log(){ | |
| console.log(index); | |
| } | |
| function iterate(){ | |
| log(); | |
| if(index>1) setTimeout(iterate, 1000); |
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
| var Person = function(name) { | |
| this.name = name | |
| } | |
| Person.prototype.getName = function() { return this.name } | |
| var thomas = new Person('Thomas'); | |
| var amy = new Person('Amy'); | |
| thomas.name // --> "Thomas" | |
| Person.prototype.name = "Amy" |
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
| # config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/ | |
| # added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com) | |
| # clearly this could be cleaner, but it does work | |
| require 'rack' | |
| require 'rack-legacy' | |
| require 'rack-rewrite' | |
| # patch Php from rack-legacy to substitute the original request so | |
| # WP's redirect_canonical doesn't do an infinite redirect of / |
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
| # From the project root | |
| rvm env -- `rvm current` >> .powenv |
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 Array | |
| include ActionView::Helpers::TextHelper | |
| def to_inventory | |
| c = {} | |
| each { |e| c[e.class.name] = c[e.class.name].to_i + 1 } | |
| c.sort.map{ |k, v| pluralize(v, k) }.to_sentence | |
| 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
| class Array | |
| def method_missing(method_name, *args, &block) | |
| if method_name.to_s.is_plural? | |
| map{ |e| e.send(method_name.to_s.singularize) } | |
| else | |
| super | |
| end | |
| end | |
| def respond_to?(method_name, include_private = 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
| A: # If using naked domain redirects via Google | |
| 216.239.32.21 | |
| 216.239.34.21 | |
| 216.239.36.21 | |
| 216.239.38.21 | |
| MX: # If using Google Mail | |
| 1 ASPMX.L.GOOGLE.COM. | |
| 5 ALT1.ASPMX.L.GOOGLE.COM. | |
| 5 ALT2.ASPMX.L.GOOGLE.COM. |