| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
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/env sh | |
| # checks to see if running | |
| launchctl list | grep mongo | |
| launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist | |
| launchctl remove homebrew.mxcl.mongodb | |
| pkill -f mongod |
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
| Symlinking the .meteor/local directory to a non-shared directory worked for me. | |
| Removing the existing .meteor/local locally: | |
| cd $MY_APP_DIR | |
| cp -R .meteor .meteor.bak | |
| rm -R .meteor/local | |
| Then from within the vagrant vm: | |
| mkdir -p /home/vagrant/.meteorlocal |
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] | |
| lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all | |
| lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
| lg = !"git lg1" | |
| ------------- | |
| git blame name_file | |
| git stash | |
| git stash pop |
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
| sudo service postgresql restart |
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
| Commit the extra changes you want. | |
| You now have newest commit and commit you want to update. | |
| git log -> determine id of commit right before the commit you want to update. 0e841350 | |
| git rebase --interactive 0e841350^ (The ^ is to tell you want to combine) | |
| --> change entry to s/squash to indicate the one you want to merge in the previous one. | |
| Safe the file | |
| --> new window opens with opportunity to change git commit message | |
| Save and then push to remote: | |
| git push --force origin master |
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
| require 'pry' | |
| # Determine whether a string contains a SIN (Social Insurance Number). | |
| # A SIN is 9 digits and we are assuming that they must have dashes in them | |
| def has_sin?(string) | |
| /\b\d{3}-\d{3}-\d{3}\b/.match(string) != nil | |
| end | |
| puts "has_sin? returns true if it has what looks like a SIN" | |
| puts has_sin?("please don't share this: 234-604-142") == true |
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
| def benchmark | |
| start_time = Time.now | |
| yield | |
| end_time = Time.now | |
| running_time = end_time - start_time | |
| end | |
| long_string = "apple" * 100000000 | |
| running_time = benchmark { long_string.reverse } |
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
| def redeem(dollar_amount) | |
| bottles_amount = dollar_amount / 2 | |
| recycle_bottles = bottles_amount / 2 | |
| recycle_caps = bottles_amount / 4 | |
| recycle_total = recycle_bottles + recycle_caps | |
| bottles_remaining = bottles_amount % 2 | |
| caps_remaining = bottles_amount % 4 | |
| [" Dollar Amount: #{dollar_amount}", | |
| " Total Amount Bottles Purchased: #{bottles_amount}", |
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 Romans | |
| CONVERSIONS = { | |
| 1 => 'I', | |
| 4 => 'IV', | |
| 5 => 'V', | |
| 9 => 'IX', | |
| 10 => 'X', | |
| 40 => 'XL', | |
| 50 => 'L', | |
| 90 => 'XC', |