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 assert = require('assert'); | |
| function pigLatin(input) | |
| { | |
| var result = input; | |
| result = result.replace(/(\w+)/g, function(match) | |
| { | |
| var firstChar = match.charAt(0), | |
| firstCharCode = firstChar.charCodeAt(0), |
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
| function pigTranslate(phrase){ | |
| return phrase.split(" ").map(function(item){ | |
| return wordTranslate(item); | |
| }).join(" "); | |
| } | |
| function wordTranslate(word){ | |
| var firstLetter = word.substring(0,1); | |
| var restOfWord = word.substring(1); | |
| if(firstLetter.match(/[A-Z]/)){ | |
| firstLetter = firstLetter.toLowerCase(); |
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
| # bash <(curl -s https://raw.github.com/gist/2891426) | |
| read -p "Install Xcode (from the App store) and gcc for Lion (http://github.com/kennethreitz/osx-gcc-installer) and press enter to continue." | |
| # setup your ssh keys for github | |
| if ! [ -e "$HOME/.ssh/id_rsa.pub" ] | |
| then | |
| echo "Generating ssh key..." | |
| read -p "Please enter the email you want to associate with your ssh key: " email | |
| ssh-keygen -t rsa -C "$email" |
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
| # See: | |
| # http://www.linux-france.org/prj/imapsync_list/msg00616.html | |
| # http://www.linux-france.org/prj/imapsync_list/msg00639.html | |
| imapsync \ | |
| --fast \ | |
| [email protected] [email protected] \ | |
| --password1 password1 \ | |
| [email protected] [email protected] \ | |
| --password2 password2 \ |
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
| # Alias heroku for simpler multi-app projects | |
| heroku-app() { | |
| args=("$@") | |
| if [ "${args[1]}" = "staging" ]; then | |
| args+=("--app" "goodeggs-garbanzo-staging") | |
| index=1 | |
| elif [ "${args[1]}" = "production" ]; then | |
| args+=("--app" "goodeggs-garbanzo") | |
| index=1 | |
| else |
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
| # Monkey patch jasmine.Env to wrap spec ('it', 'beforeEach', 'afterEach') | |
| # in async handler if it expects a done callback | |
| withoutAsync = {} | |
| for jasmineFunction in [ "it", "beforeEach", "afterEach"] | |
| do (jasmineFunction) -> | |
| withoutAsync[jasmineFunction] = jasmine.Env.prototype[jasmineFunction] | |
| jasmine.Env.prototype[jasmineFunction] = (args...) -> | |
| specFunction = args.pop() | |
| # No async callback expected, so not async | |
| if specFunction.length == 0 |
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
| describe 'User', -> | |
| describe '#save()', -> | |
| it 'should save without error', (done) -> | |
| user = new User('Luna') | |
| user.save(done) |
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
| describe 'User', -> | |
| describe '#save()', -> | |
| it 'should save without error', (done) -> | |
| user = new User('Luna') | |
| user.save (error) -> | |
| expect(error).toBeNull() | |
| done(); |
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
| process.env.NODE_ENV = 'test' unless process.env.NODE_ENV? | |
| require './jasmine_runner' unless jasmine? | |
| #... |
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
| coffee --nodejs --debug-brk spec/app.spec.coffee |