Skip to content

Instantly share code, notes, and snippets.

Looking for new opportunities

Dan Levy justsml

Looking for new opportunities
Block or report user

Report or block justsml

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
justsml / insertAdjacentHTML.js
Last active Feb 11, 2020 — forked from eligrey/insertAdjacentHTML.js
insertAdjacentHTML polyfill
View insertAdjacentHTML.js
* Updated w/ insertAdjacentElement
* @author Dan Levy @justsml
* 2016-06-23
* Credit: @lyleunderwood - afterend patch/fix
* ```js
* import { insertAdjacentElement } from './libs/insertAdjacentHTML.js';
* Use either:
View postgres

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.


installation, Ubuntu

View auth-complex.js
// Easier to follow. Equally easy to test -- and with one fewer function in need of testing.
import { userInfo } from "os";
const Promise = require("bluebird");
const { hashStringAsync } = Promise.promisifyAll(require("./lib/crypto"));
const { logEventAsync } = Promise.promisifyAll(require("./lib/log"));
const { openAsync } = Promise.promisifyAll(require("./lib/db"));
const { TimeoutError, ValidationError, NotFoundError } = require("./errors");
justsml / myController.js
Last active Aug 29, 2018 — forked from Tinusw/myController.js
a promise example
View myController.js
const mongoose = require('mongoose');
const Store = mongoose.model('Store');
const StoreB = mongoose.model('StoreB');
// Tells package to use es6 promises
mongoose.Promise = global.Promise;
exports.createStore = (req, res, next) => {
const store = new Store(req.body);
const itemB = StoreB
justsml /
Created Jul 11, 2018 — forked from Kartones/
PostgreSQL command line cheatsheet


Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
justsml /
Last active Mar 26, 2018 — forked from rands0n/
echo "Starting XCode Command Line Tools Setup... Continue using the GUI prompt..."
sleep 4s
xcode-select --install
echo "DONE: Installing XCode Command Line Tools\!"
# install homebrew
/usr/bin/ruby -e "$(curl -fsSL"
justsml /
Last active Dec 30, 2017 — forked from tylerwalts/
This is a bash script to setup Mac OS X defaults on a new mac.
# Set up OSX preferences
# Updated By: Dan Levy @justsml
# Inspired by:
View bluebird-concurrent-download-using-map-then.js
const Bluebird = require('bluebird')
const got = require('got')
const urls = [
// Bluebird is an extension of promises:
View beautiful-html5-dialog.css
dialog {
position: fixed;
top: 50%;
left: 50%;
right: auto;
padding: 30px;
transform: perspective(500px) translate(-50%, -50%);
background: linear-gradient(to bottom, #FFF, #F4F4F4) #FFF;
border: none;
border-radius: 3px;
justsml / PinchZoomPan.js
Last active Oct 4, 2017 — forked from iammerrick/PinchZoomPan.js
React Pinch + Zoom + Pan
View PinchZoomPan.js
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ANIMATION_SPEED = 0.04;
const INITIAL_X = 0;
You can’t perform that action at this time.