Skip to content

Instantly share code, notes, and snippets.

@vikikamath
vikikamath / brew_install_docker.sh
Created June 24, 2019 01:31
Install docker-toolbox on older mac books that do not have hardware support for virtualization.
brew cask
brew cask install docker-toolbox
docker-machine create --driver "virtualbox" myBoxName
docker-machine start myBoxName
# copy to .bash_profile or .zshrc to be executed everytime
eval "$(docker-machine env myBoxName)"
@vikikamath
vikikamath / levelOrderHNFetchStoryWithComments.js
Created June 25, 2017 01:42
Fetch hackernews API using es6 generator functions and fetch API on Node@6
const fetch = require( 'node-fetch' ) // skip if in Chrome Latest version
const hnItemUrlBase = 'https://hacker-news.firebaseio.com/v0/item/' // HN Url Base
const hnItemId = 14561637 // real itemId
// hacker news required format
const makeItemUrl = ( prefix, itemId ) => `${prefix}${itemId}.json`
// fetch Wrapper
const fetchWrapper = ( prefix, itemId ) => {
@vikikamath
vikikamath / flattenArrays.js
Last active December 3, 2016 18:00
Flatten deeply nested Array of Integers
/*
@input: Input array to be flattened
@result: Empty Array
@return:
invalid input: Empty Array
valid input (an Array): Flattened Array
*/
function flatten(input, result) {
@vikikamath
vikikamath / blah.json
Created January 25, 2016 06:06
Playing with oboe.js
{
"v":1,
"t":[{
"t":7,
"e":"form",
"f":[{
"t":7,
"e":"label",
"f":["Without Focus Handler"]
},
@vikikamath
vikikamath / index.js
Created October 2, 2015 03:14
RequireJS-Node-Mocha-Chai Scaffolding
define(function(require){
return "success";
});
@vikikamath
vikikamath / gist:78b05a0e4d8f23e871c9
Last active June 24, 2019 01:14
Reduce Array to Max
[5, 45, 53,2, 43,21].reduce((max, current) => maax > current ? max : current, -Infinity);
@vikikamath
vikikamath / index.js
Last active August 29, 2015 14:15
JSON transformation using Oboe
var oboe = require('oboe')
fs = require('fs')
path = require('path')
mkdirp = require('mkdirp')
mv = require('mv')
rootDir = path.join(__dirname, 'dist')
apps = [] // temp store for all apps found in a
urls = {} // temp store for all urls found in a config file
@vikikamath
vikikamath / conversions
Created January 16, 2015 03:17
Hex 2 ASCII to String ( Thanks to responses from Stackoverflow)
function str2hex(str){
var arr = [];
str.split('').forEach(function(c){
arr.push(c.charCodeAt());
});
return arr;
}
function hexarr2str(arr){
@vikikamath
vikikamath / README.md
Created April 18, 2014 19:13
gitbook ./mygitbook containing README.md and SUMMARY.md that generated _book/index.html and _book/search_index.json

This is a readme