Skip to content

Instantly share code, notes, and snippets.

@WebReflection
WebReflection / html-escape.md
Last active August 21, 2022 16:27
How to escape and unescape from a language to another

update

I've created a little repository that simply exposes the final utility as npm module.

It's called html-escaper


there is basically one rule only: do not ever replace one char after another if you are transforming a string into another.

@sebmarkbage
sebmarkbage / Enhance.js
Last active February 10, 2025 06:23
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 20, 2025 21:15
The best FRP iOS resources.

Videos

@tel
tel / FAlg.ml
Created February 16, 2015 19:29
More F-algebra things in OCaml
module type Functor = sig
type 'a t
val map : ('a -> 'b) -> ('a t -> 'b t)
end
module Iso = struct
type ('a, 'b) t = { fwd : 'a -> 'b; bck : 'b -> 'a }
let fwd i = i.fwd
let bck i = i.bck
@xcoderzach
xcoderzach / function_bind_syntax.js
Last active August 29, 2015 14:15
Function Bind Syntax
import _ from 'lodash'
function ooify(fn) {
return function() {
return fn.apply(this, [this].concat([].slice.call(arguments)))
}
}
var methods = _.zipObject(_.map(_.keys(_.prototype), methodName => {
return [methodName, ooify(_[methodName])]
}))
@getify
getify / gist:7ae82fdc2e86bf66bcba
Last active March 27, 2022 19:50
List of ES6 books either out or in progress...
@patrickarlt
patrickarlt / build.sh
Last active March 25, 2020 04:42
ES 7 async/await demo!
babel github-es6.js -o github.js --optional runtime --experimental
@cqfd
cqfd / Applicatives.hs
Created March 5, 2015 16:30
Free applicative functors in terms of liftA2.
{-# LANGUAGE ExistentialQuantification #-}
import Control.Applicative
import Data.Functor.Identity
data Ap f a = Pure a
| forall x y. LiftA2 (x -> y -> a) (f x) (Ap f y)
instance Functor f => Functor (Ap f) where
fmap f (Pure a) = Pure (f a)
@brattonc
brattonc / README.md
Last active April 3, 2025 17:43
D3 Liquid Fill Gauge

Liquid Fill Gauge v1.1 - 7/14/2015

Changes:

  • Added support for updating the gauge value after loading is complete. The loadLiquidFillGauge method now returns an object with an update method which allows the gauge value to be changed. Click any of the gauges above to randomly update their value.

Configurable features include:

  • Changeable min/max values.
  • All colors.
{-# LANGUAGE RankNTypes #-}
data Proc a = Action1 a | Action2 a | Action3 a
newtype Yoneda f a = Yoneda { runYoneda :: forall b. ((a -> b) -> f b) }
instance Functor (Yoneda f) where
fmap f m = Yoneda (\k -> runYoneda m (k . f))
data Free f a = Pure a | Free (f (Free f a))