This file contains 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
// String utils | |
// | |
// resources: | |
// -- mout, https://github.com/mout/mout/tree/master/src/string | |
/** | |
* "Safer" String.toLowerCase() | |
*/ | |
function lowerCase(str) { | |
return str.toLowerCase(); |
This file contains 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
# Usage: curl -L https://gist.github.com/tomarak/f87b97bb84080907aaa4.sh | zsh && chsh -s $(which zsh) | |
# sudo apt-get install git zsh wget curl | |
# chmod 777 prezto-install.sh | |
# ./prezto-install | |
echo "Cloning prezto" | |
rm -rf "${ZDOTDIR:-$HOME}/.zprezto" | |
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" | |
echo "Symlinking all requires zsh dot files" |
This file contains 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
console.log("Before the first file is read."); | |
hypotheticalFileGetContents("sample.txt", function(fileContents){ | |
// fileContents now contains the file contents, this function is only called when the file read in the background has finished | |
console.log("After the first file has completed reading."); | |
}); | |
// You've now told it to start the first read, but it won't 'block' your script execution. It will do the read in the background, and immediately move on with the rest of your code. | |
console.log("Before the second file is read."); | |
hypotheticalFileGetContents("sample2.txt", function(fileContents){ |
This file contains 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 'node_modules' to .gitignore file | |
git rm -r --cached node_modules | |
git commit -m 'Remove the now ignored directory node_modules' | |
git push origin master |
This file contains 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
exports.addCarPhoto = function(req, res) { | |
var userID = req.user._id; | |
var carsBaseURI = "http://sobrioapp.blob.core.windows.net/cars/"; | |
// setup photo meta data | |
var type = req.files.photo.type; | |
var filename = req.params.id + "-" + req.files.photo.name; | |
var path = req.files.photo.path; |
This file contains 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
/********************************* | |
Get state codes from name and vice-versa | |
*********************************/ | |
function ConvertStateNameTo(name, to) { | |
var name = name.toUpperCase(); | |
var states = new Array( | |
{'name':'Alabama', 'abbrev':'AL'}, | |
{'name':'Alaska', 'abbrev':'AK'}, | |
{'name':'Arizona', 'abbrev':'AZ'}, | |
{'name':'Arkansas', 'abbrev':'AR'}, |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |