(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
class GetLabelType (rl ∷ RowList) (s ∷ Symbol) (a ∷ Type) | rl s → a where | |
labelType ∷ RLProxy rl → SProxy s → Proxy a | |
instance getLabelTypeFound ∷ GetLabelType (Cons s a tail) s a where | |
labelType _ _ = Proxy | |
else instance getLabelTypeNotFound ∷ GetLabelType (Cons s a tail) s Void where | |
labelType _ _ = Proxy | |
else instance getLabelTypeInd ∷ GetLabelType tail ss b ⇒ GetLabelType (Cons s a tail) ss b where | |
labelType _ _ = labelType (RLProxy ∷ RLProxy tail) (SProxy ∷ SProxy ss) | |
else instance getLabelTypeVoid ∷ GetLabelType Nil s Void where |
/* | |
* `match` is a helper function for writing pattern matches on types that are | |
* implemented using Scott encoding. | |
* | |
* @flow | |
*/ | |
export function match<A,B>(matcher: A): (match: (matcher: A) => B) => B { | |
return match => match(matcher) | |
} |
const daggy = require('daggy'); | |
const {foldMap} = require('pointfree-fantasy') | |
const {concat, toUpper, prop, identity, range, compose} = require('ramda'); | |
// Contravariant functors usually have this shape F(a -> ConcreteType). | |
// In other words, some type holding a function which is parametric on its input, but not output. | |
// They don't always have that shape, but it's a good intuition | |
// Covariant functors are what we're used to, which are parametric in their output | |
//================================================================ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with | |
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This | |
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise. | |
var gulp = require('gulp'), | |
spawn = require('child_process').spawn, | |
node; | |
/** | |
* $ gulp server | |
* description: launch the server. If there's a server already running, kill it. |
#!/bin/bash | |
#take a configurable service from first argument | |
if [ $# = 1 ] | |
then | |
SERVICE_NAME=$1 | |
fi | |
#otherwise get the active one | |
if [ $# = 0 ] |
The spec has moved to a repo: https://github.com/defunctzombie/package-browser-field-spec to facilitate collaboration.
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
# Parses YouTube URLs directly or from iframe code. Handles: | |
# * Address bar on YouTube url (ex: http://www.youtube.com/watch?v=ZFqlHhCNBOI) | |
# * Direct http://youtu.be/ url (ex: http://youtu.be/ZFqlHhCNBOI) | |
# * Full iframe embed code (ex: <iframe src="http://www.youtube.com/embed/ZFqlHhCNBOI">) | |
# * Old <object> tag embed code (ex: <object><param name="movie" value="http://www.youtube.com/v/ZFqlHhCNBOI">...) | |
/(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/ | |
$5 #=> the video ID | |
# test it on Rubular: http://rubular.com/r/eaJeSMkJvo |