Skip to content

Instantly share code, notes, and snippets.

View dgaitsgo's full-sized avatar

David Gaitsgory dgaitsgo

View GitHub Profile
@dgaitsgo
dgaitsgo / asyncForEach.js
Created March 11, 2019 23:46
Async For Each
async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}
@dgaitsgo
dgaitsgo / ssh-active-docker-machine.sh
Created March 7, 2019 05:00
SSH into active docker machine
#!/bin/bash
docker_machine_name=$(docker-machine active)
docker_ssh_user=$(docker-machine inspect $docker_machine_name --format={{.Driver.SSHUser}})
docker_ssh_key=$(docker-machine inspect $docker_machine_name --format={{.Driver.SSHKeyPath}})
docker_ssh_port=$(docker-machine inspect $docker_machine_name --format={{.Driver.SSHPort}})
ssh -i $docker_ssh_key -p $docker_ssh_port $docker_ssh_user@localhost
@dgaitsgo
dgaitsgo / .gitignore
Last active March 2, 2019 09:43
Typescript React Native - App Setup
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
@dgaitsgo
dgaitsgo / index.js
Created February 27, 2019 04:18
Local storage helper
import PouchDB from 'pouchdb'
import PouchDBFind from 'pouchdb-find'
import PouchDbQuickSearch from 'pouchdb-quick-search'
PouchDB.plugin(PouchDBFind)
PouchDB.plugin(PouchDbQuickSearch)
//convenience function do get individual error handling for an array of Promises
const to = promise =>
promise.then(data => [null, data])
@dgaitsgo
dgaitsgo / compare.json
Created February 26, 2019 23:40
Models to Compare Json
{
"e27390fd-e2a2-57d5-ad4f-a2d63371c851": {
"model": {
"id": "e27390fd-e2a2-57d5-ad4f-a2d63371c851",
"name": "Fabia Wagon"
},
"defaultOptions": {
"data": [
{
"id": "73dc2d3b-b071-5802-8b81-b4c7f3bd354b"
@dgaitsgo
dgaitsgo / modelsPerBrand.json
Created February 26, 2019 01:43
Volkswagen Group (example) models per brand
{
"d3f207e5-18d8-5bd2-a5fa-a1acc05629fa" : {
"name" : "Volkswagen Passenger Cars",
"id": "d3f207e5-18d8-5bd2-a5fa-a1acc05629fa",
"models" : [
{
"id": "ef7f7c23-2537-5067-9c0b-25f77433a1de",
"name": "Der up!"
},
{
@dgaitsgo
dgaitsgo / quadratic.clj
Last active December 29, 2018 09:00
Clojure 2nd Degree Polynomial Solver
(def precision 0.000000001)
(defn findDiscriminant [a b c] (- (* b b) (* (* 4 a) c)))
(defn abs [n]
(if (< n 0) (- n) n))
(defn factorial [n]
(if (= n 1)
1
@dgaitsgo
dgaitsgo / .block
Last active July 27, 2018 14:48
Heatmap of Nasdaq daily trade volume between January and May 2017
license: gpl-3.0
@dgaitsgo
dgaitsgo / .block
Last active July 26, 2018 21:27
Force layout of Korean syllable blocks found in Bible by frequency
license: gpl-3.0
@dgaitsgo
dgaitsgo / .block
Last active July 26, 2018 20:09
Massachusetts Population Density by 2016 Census Tract
license : gpl-3.0