GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • All gists
  • Back to GitHub
  • Sign in
  • Sign up
  • All gists 92
  • Forked 5
  • Starred 24
  • Terms
  • Privacy
  • Security
  • Status
  • Community
  • Docs
  • Contact

This view

  • Original page
  • New address

GeezerVison is showing gist.github.com — unscriptable’s gists

Instantly share code, notes, and snippets.

View unscriptable's full-sized avatar
🏔️

John Hann unscriptable

🏔️
TypeScript, Haskell, JavaScript
623 followers · 27 following
  • MA, USA
  • https://gist.github.com/unscriptable
View GitHub Profile
    • Recently created
    • Least recently created
    • Recently updated
    • Least recently updated
  • 1 file
  • 0 forks
  • 0 comments
  • 0 stars
@unscriptable
unscriptable / partition.ts
Last active May 25, 2023 13:47
Typescript functions to share
/**
* Separate a list into two lists (left and right) using a predicate to detect
* items that should be in the left list. The rest go into the right list.
*
* @param isLeft - predicate to detect items that should be in the left list
*
* @returns a function that accepts an array and returns a pair of arrays
*
* @todo - return type [ L[], R[] ] instead of ambiguous type.
*/
  • 10 files
  • 1 fork
  • 0 comments
  • 1 star
@unscriptable
unscriptable / .gitignore
Last active April 21, 2023 18:53
Most + redis + docker
node_modules
.DS_Store
  • 1 file
  • 0 forks
  • 1 comment
  • 0 stars
@unscriptable
unscriptable / Makefile
Last active February 12, 2019 15:19
Makefile to compile Elm in a container
# NOTE will not work with make -v 3.81 or lower
SHELL = /bin/bash
.RECIPEPREFIX = >
# run docker as current user so we don't get elm-stuff permissions problems
UID ?= $(shell id -u):$(shell id -g)
GIT_REPO_ROOT ?= $(PWD)
PROJECT_ROOT := $(GIT_REPO_ROOT)
  • 3 files
  • 0 forks
  • 0 comments
  • 1 star
@unscriptable
unscriptable / README.md
Last active February 12, 2024 00:32
Datalist polyfill

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

  • 6 files
  • 0 forks
  • 0 comments
  • 1 star
@unscriptable
unscriptable / .gitignore
Last active July 31, 2017 18:37
Creates a most.js UMD module with creed's ultra-fast Promise implementation packaged in as the Promise shim.
node_modules/
  • 1 file
  • 0 forks
  • 0 comments
  • 0 stars
@unscriptable
unscriptable / papply.js
Created January 30, 2017 20:31
Function to partially apply function args even if the function might be "manually curried".
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) {
  • 1 file
  • 0 forks
  • 0 comments
  • 1 star
@unscriptable
unscriptable / unfoldWith.js
Last active February 12, 2024 00:33
// 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) => {
  • 1 file
  • 0 forks
  • 0 comments
  • 1 star
@unscriptable
unscriptable / template.js
Last active February 12, 2024 00:33
Mostly for fun, I created a simple template function using functional JavaScript patterns and ES6 syntax. Kinda like mustache, but much simpler.
// 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)))
// ------------------------------------------------------------
  • 1 file
  • 0 forks
  • 0 comments
  • 1 star
@unscriptable
unscriptable / sendSms-ioc.js
Created October 21, 2016 15:28
Code snippet used in an IoC blog post
import _ from "lodash"
export const smsMessage = (template, isValidPhone) => {
const createMessage = _.template(template)
const validate = throwIfInvalidPhone(isValidPhone)
return _.compose(validate, createMessage)
}
const throwIfInvalidPhone = isValidPhone => user => {
  • 1 file
  • 0 forks
  • 0 comments
  • 0 stars
@unscriptable
unscriptable / sendSms-traditional.js
Created October 21, 2016 15:27
Code snippet used in an IoC blog post
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()
NewerOlder
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.