Skip to content

Instantly share code, notes, and snippets.

View nkt217's full-sized avatar

Ankit Verma nkt217

  • Banglore
View GitHub Profile
@nkt217
nkt217 / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/*********************************
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'},
@nkt217
nkt217 / AzureStorage.js
Created May 3, 2017 12:41 — forked from jrthib/AzureStorage.js
NodeJS Photo Upload with Azure Storage
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;
@nkt217
nkt217 / gist:d642ea430afc6753c1bce755ab37d081
Created September 11, 2017 07:13 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#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
@nkt217
nkt217 / asynchronous.js
Created February 23, 2018 11:41 — forked from joepie91/asynchronous.js
PHP vs Node.js: Synchronous vs Asynchronous
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){
@nkt217
nkt217 / prezto-install.sh
Last active January 24, 2019 11:48
001-development-environment-setup
# 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"
@nkt217
nkt217 / string-utils.js
Created November 1, 2019 10:13 — forked from jonlabelle/string-utils.js
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str) {
return str.toLowerCase();
@nkt217
nkt217 / rn-with-wsl-wsa.md
Created October 28, 2021 13:58 — forked from xquangdang/rn-with-wsl-wsa.md
Develop React Native app with WSL and WSA

Develop React Native app with WSL and WSA

Requirement

  • Windows Subsystem for Linux 2 (WSL2)
  • Windows Subsystem for Android (WSA)
  • NodeJS install inside WSL2

Steps

WSA