| ⌘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
| //FizzBuzzPlus Challenge from CodeYear | |
| var FizzBuzzPlus = { //create an object called FizzBuzzPlus | |
| isFizzBuzzie: function(num) { // Create function isFizzBuzzie with one argument: an integer | |
| if(num % 3 === 0 && num % 5 === 0) { // return false if the provided integer is a multiple of both 3 and 15 | |
| return false; | |
| } | |
| else if ( num % 3 === 0 || num % 5 === 0) { //return true if the provided integer is a multiple of 3 or 15 (not both) |
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
| #extends Fixnum class with prim? method. usage ex: 5.prime? | |
| #returns a boolean | |
| class Fixnum | |
| def prime? | |
| ('1' * self) !~ /^1?$|^(11+?)\1+$/ | |
| 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
| function fizzbuzz(num) { | |
| if(num === 0) { //base case | |
| return 1; | |
| }if(num < 0) { //termination case | |
| return console.log("Positive numbers only, please."); | |
| }if((num % 3 === 0) && (num % 5 === 0)) { //fizzbuzz conditionals | |
| console.log("fizzbuzz"); | |
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 Card(suit, num) { | |
| var cardSuit = suit; | |
| var cardNum = num; | |
| this.getNumber = function() { | |
| return cardNum; | |
| }; | |
| this.getSuit = function() { | |
| return cardSuit; | |
| }; | |
| this.getValue = function() { |
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
| # returns true N percent of the time. | |
| # pass in a threshold number N from 1-100 | |
| def random_threshold (percentage) | |
| # number_pool of 100 numbers. | |
| number_pool = (1..100).to_a | |
| # return true if random number_pool sample is below threshold N. | |
| number_pool.sample < percentage ? true : false | |
| 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
| var no; | |
| var name2; | |
| var yes; | |
| var gender; | |
| var so; | |
| var comma; | |
| var iscool; | |
| var invitationQuestion; | |
| function convo() { | |
| name2 = window.prompt('please enter your name'); |
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
| //JS | |
| //=============================================================================== | |
| //Modal centering Script: | |
| $('#YourModal').modal().css( | |
| { | |
| 'margin-top': function () { | |
| return window.pageYOffset-($(this).height() / 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
| [alias] | |
| co = checkout | |
| st = status | |
| rso = remote show origin | |
| # e.g. git graphviz --first-parent master | dotty /dev/stdin | |
| graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f" | |
| # Pretty log | |
| lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
| # Print out all commits whose hash starts with a given string | |
| abbr = "!sh -c 'git rev-list --all | grep ^$1 | while read commit; do git --no-pager log -n1 --pretty=format:\"%H %ci %an %s%n\" $commit; 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
| ### Add RVM to PATH for scripting | |
| PATH=$PATH:$HOME/.rvm/bin | |
| ### Add bin to my PATH | |
| PATH=$HOME/bin:$PATH | |
| ### Added by the Heroku Toolbelt | |
| export PATH="/usr/local/heroku/bin:$PATH" |