Skip to content

Instantly share code, notes, and snippets.


Dan Levy justsml

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 /
Last active Nov 18, 2019
JavaScript Fetch API Examples
justsml / AsyncObjectStore.js
Last active Nov 8, 2019
Add auto JSON encoding to `localStorage` & `AsyncStorage` (from React Native)
View AsyncObjectStore.js
Utility for React Native's AsyncStorage module.
Auto encodes/decodes using `JSON`.
Essentially data is saved as key/value to available flash/SD storage.
import { AsyncStorage } from "react-native"
export default {
setItem(key, value) {
return AsyncStorage.setItem(key, JSON.stringify(value))
justsml / insertAdjacentHTML.js
Last active Oct 15, 2019 — 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:
justsml / index.html
Last active Oct 7, 2019
User Interface I: Airport Starter File
View index.html
Semantic Markup === Meaningful code
Some semantic markup examples:
set -e
# REQUIRED ACTION: Configure your backup server vars - see OVH Server Manager's "Backups" tab.
# BACKUP_HOST_PREFIX: use the prefix domain for the listed "Name" value on the "Backups" tab.
# Example: With a 'Name' value `` you would need to set `BACKUP_HOST_PREFIX=ftpback-bhs1-3`
# Add something likethese to your ~/.bashrc - /etc/profile
#export OVH_SERVER_ID=""
#export BACKUP_HOST_PREFIX="ftpback-bhs1-x"
View promised-timeout.js
function promiseTimeout(msec) {
return promise => {
const timeout = new Promise((yea, nah) => setTimeout(() => nah(new Error('Timeout expired')), msec))
return Promise.race([promise, timeout])
.then(response => response.json())
.then(data => {
justsml /
Last active Jul 28, 2019
Docker Setup for Server Host, DB Instances, and NodeJS App

Docker Host Server Setup, w/ Basic Monitoring Tools

# Updates
apt-get update && apt-get install -y vim-nox git-core ufw curl atop htop build-essential libssl-dev linux-image-amd64 linux-headers-amd64

# Updates Profile init scripts
cd ~/
curl -sSL > .bash_aliases_new
cat .bash_aliases_new >> .bash_aliases
View passport-auth-knex.js
const http = require('http')
const express = require('express')
const session = require('express-session')
const FileStore = require('session-file-store')(session)
const bodyParser = require('body-parser')
const morgan = require('morgan')
const cors = require('cors')
const passport = require('passport')
PACKAGES=$(cat "${1:-/dev/stdin}" | \
grep "require([\"'][^'\"]*.)" | \
sed 's/^[^(]*(.//g' | \
sed 's/.[\)]*[a-zA-Z;]*$//' | \
sed "s/.[)].*$//" | \
sort | uniq)
# Remove NodeJS built-ins
You can’t perform that action at this time.