Skip to content

Instantly share code, notes, and snippets.

View neilmock's full-sized avatar

Neil Mock neilmock

View GitHub Profile
@neilmock
neilmock / PhantomTypeReasonML.md
Created December 21, 2017 17:33 — forked from busypeoples/PhantomTypeReasonML.md
Phantom types in ReasonML

Phantom types in ReasonML

Introduction

"A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition..." Haskell Wiki, PhantomType

The following write-up is intended as an introduction into using phantom types in ReasonML.

Taking a look at the above definition from the Haskell wiki, it states that phantom types are parametrised types where not all parameters appear on the right-hand side. Let's try to see if we can implement a similar example as in said wiki.

let rec merge x y =>
switch (x, y) {
| ([], l) => l
| (l, []) => l
| ([hx, ...tx], [hy, ...ty]) =>
if (hx < hy) {
[hx, ...merge tx [hy, ...ty]]
} else {
[hy, ...merge [hx, ...tx] ty]
}

Keybase proof

I hereby claim:

  • I am neilmock on github.
  • I am neilmock (https://keybase.io/neilmock) on keybase.
  • I have a public key ASBPpckgnE0Vhgs27I1ijT3IZVlhVO6uuIPBxF20lnhq8Qo

To claim this, I am signing this object:

@neilmock
neilmock / linux.txt
Created July 7, 2016 15:39
figwheel webjars
clojure.lang.ExceptionInfo: Error in component :figwheel-system in system com.stuartsierra.component.SystemMap calling #'com.stuartsierra.component/start {:reason :com.stuartsierra.component/component-function-threw-exception, :function #'com.stuartsierra.component/start, :system-key :figwheel-system, :component #figwheel_sidecar.system.FigwheelSystem{:system #object[clojure.lang.Atom 0x48eb05e9 {:status :ready, :val #<SystemMap>}]}, :system #<SystemMap>}
at clojure.core$ex_info.invokeStatic(core.clj:4617)
at clojure.core$ex_info.invoke(core.clj:4617)
at com.stuartsierra.component$try_action.invokeStatic(component.cljc:119)
at com.stuartsierra.component$try_action.invoke(component.cljc:116)
at com.stuartsierra.component$update_system$fn__17933.invoke(component.cljc:139)
at clojure.lang.ArraySeq.reduce(ArraySeq.java:109)
at clojure.core$reduce.invokeStatic(core.clj:6544)
at clojure.core$reduce.invoke(core.clj:6527)
at com.stuartsierra.comp
user> (cons 1 (list 1 2 3))
(1 1 2 3)
user> (list 1 2 3)
(1 2 3)
(ns com.neilmock.enduro-redis
(:require [alandipert.enduro :as enduro]
[clojure.string :as str])
(:import (alandipert.enduro EnduroAtom)
java.net.URI
(redis.clients.jedis Jedis JedisPool JedisPoolConfig)))
(defn- jedis-pool [url]
(let [uri (URI. url)
host (.getHost uri)
The Arky win agains Okla was because Switzer was caught with Larry Lacewell's wife. Frank Broyes got Lacewell the Ark State job in return for the Sooners gameplan Arky had several players suspended for that game and still won Lacewell' gave him the gameplan,hang signals everything 
@neilmock
neilmock / backup.sh
Created June 27, 2012 13:48 — forked from nherment/backup.sh
Backup and restore an Elastic search index (shamelessly copied from http://tech.superhappykittymeow.com/?p=296)
#!/bin/bash
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
@neilmock
neilmock / .gitignore
Created June 22, 2012 12:03 — forked from karmi/.gitignore
Bootstrap, install and configure ElasticSearch with Chef Solo
.DS_Store
node.json
tmp/