brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
function getStuff() { | |
var result; | |
jQuery.get("amazing/long/method"), function(response) { | |
result = response; | |
} | |
return result; | |
} | |
var stuff = getStuff(); | |
console.log("This is THE stuff - "+ stuff); |
let iReturnEarly = true; | |
const willAddNewPost = new Promise( | |
(resolve, reject) => { | |
if(iReturnEarly) { | |
resolve("This is new post"); | |
}else { | |
reject("Damn I missed it."); | |
} | |
} |
willAddNewPost | |
.then(new_post => console.log(new_post)) | |
.catch(error_message => console.log(error_message)); |
const recordSong = function(new_post) { | |
// This is a shorthand for functions with just resolved state. | |
return Promise.resolve("I have recorded a song and "+new_post); | |
}; | |
willAddNewPost | |
.then(recordSong) | |
.then(console.log) | |
.catch(console.log); | |
// Kudos to you if you caught the shorthand in 'console.log' |
try { | |
var result1 = syncMeth1(); | |
var result2 = syncMeth2(result1); | |
var finalResult = syncMeth3(result2); | |
console.log("I DID IT - "+finalResult); | |
}catch(error){ | |
failCall(error); | |
} |
asyncMeth1() | |
.then(asyncMethod2) | |
.then(asyncMethod3) | |
.then(finalResult => console.log("I DID IT - "+finalResult)) | |
.catch(failCall); |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
class Myclass | |
@@old_methods = { oldMethod1: :new_method1, oldMethod2: :new_method2 } | |
def new_method1 | |
'Myclass#new_method1' | |
end | |
def new_method2 | |
'Myclass#new_method2' | |
end |
class MyClass | |
def old_method | |
'old_method OR new_method' | |
end | |
alias :new_method :old_method | |
# NOTE-1 : 'alias' is a keyword and not a method, that is why | |
# there is no comma (I almost everytime type a comma there !) | |
# NOTE-2 : If you want to use the method kind of syntax you can use | |
# the 'method' Module#alias_method which does the same thing | |
# but is actually a method. |