Skip to content

Instantly share code, notes, and snippets.


John Hann unscriptable

Block or report user

Report or block unscriptable

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
unscriptable / .gitignore
Last active Feb 22, 2019
Most + redis + docker
View .gitignore
unscriptable / Makefile
Last active Feb 12, 2019
Makefile to compile Elm in a container
View Makefile
# NOTE will not work with make -v 3.81 or lower
SHELL = /bin/bash
# run docker as current user so we don't get elm-stuff permissions problems
UID ?= $(shell id -u):$(shell id -g)
unscriptable /
Last active Aug 30, 2018
Datalist polyfill

Polyfill for the datalist element and list attribute for Safari on macOS

unscriptable / .gitignore
Last active Jul 31, 2017
Creates a most.js UMD module with creed's ultra-fast Promise implementation packaged in as the Promise shim.
View .gitignore
unscriptable / papply.js
Created Jan 30, 2017
Function to partially apply function args even if the function might be "manually curried".
View papply.js
export const papply =
(f, ...x) => {
const arity = f.length
const args = x.length
// shortcut no-ops for perf
if (args === arity) return f(...x)
if (args === 0) return f
if (args < arity) {
View unfoldWith.js
// Classic array unfold that works with functions that produce
// reasonably-sized output arrays.
export const unfoldWith =
f => x =>
_unfold(f, [], x)
// Recursive unfold function. Will overflow stack for very, very large unfolds.
// f should return null, if done, or return [ curr, next ] values, if not.
const _unfold =
(f, acc, value) => {
unscriptable / template.js
Last active Mar 20, 2017
Mostly for fun, I created a simple template function using functional JavaScript patterns and ES6 syntax. Kinda like mustache, but much simpler.
View template.js
// Take a text string containing tokens (of type `${name}`) and return
// a function that will replace the tokens with the properties of a given
// object. If we need to get much more sophisticated, we should
// probably use mustache or similar.
// TODO: allow dev to specify a format for each token?
export default
template => createRenderAll(partition(String(template)))
// ------------------------------------------------------------
unscriptable / sendSms-ioc.js
Created Oct 21, 2016
Code snippet used in an IoC blog post
View sendSms-ioc.js
import _ from "lodash"
export const smsMessage = (template, isValidPhone) => {
const createMessage = _.template(template)
const validate = throwIfInvalidPhone(isValidPhone)
return _.compose(validate, createMessage)
const throwIfInvalidPhone = isValidPhone => user => {
unscriptable / sendSms-traditional.js
Created Oct 21, 2016
Code snippet used in an IoC blog post
View sendSms-traditional.js
import _ from "lodash"
import { isValidPhone } from "../validation/phone"
import template from "./template"
import { DbConn } from "../Db"
import SmsService from "../SmsService"
const createMessage = _.template(template)
export const sendSms = userId => {
const service = new SmsService()
View shift.js
'use strict'
// Creates a function that clones dates and shifts by the
// seconds specified.
// Example:
// >>> import { seconds } from './shift'
// >>> const fiveSecondsLater = seconds(5)
// >>> const d = new Date()
// >>> fiveSecondsLater(d) - d
You can’t perform that action at this time.