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
# enables nvm to detect if there is an .nvmrc, if it finds it, | |
# then it should switch the configured version: | |
# https://github.com/nvm-sh/nvm#nvmrc | |
cdnvm() { | |
cd "$@"; | |
nvm_path=$(nvm_find_up .nvmrc | tr -d '\n') | |
# If there are no .nvmrc file, use the default nvm version | |
if [[ ! $nvm_path = *[^[:space:]]* ]]; then |
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 AWS = require('aws-sdk'); | |
AWS.config.update({ region: 'us-east-1' }); | |
var s3 = new AWS.S3(); | |
var obj = { | |
firstname: "Navjot", | |
lastname: "Dhanawat" | |
}; | |
var buf = Buffer.from(JSON.stringify(obj)); |
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
/** | |
* Generates number of random geolocation points given a center and a radius. | |
* @param {Object} center A JS object with lat and lng attributes. | |
* @param {number} radius Radius in meters. | |
* @param {number} count Number of points to generate. | |
* @return {array} Array of Objects with lat and lng attributes. | |
*/ | |
function generateRandomPoints(center, radius, count) { | |
var points = []; | |
for (var i=0; i<count; i++) { |