Skip to content

Instantly share code, notes, and snippets.

timhwang21 /
Last active Jan 9, 2023
Curry unary functions that take a record as an argument


This is an example of a function whose logic lives in the type definition rather than in the function body.

 * @name `curryRecord`
 * Takes a unary function that takes a record as an argument, and makes the
 * record partially applicable. Returns a new function that takes a partial of
Avaq / combinators.js
Last active Jan 19, 2023
Common combinators in JavaScript
View combinators.js
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
mmacedo /
Last active Aug 9, 2017
Source bash/zsh/ksh files
function _exec_with
set -l shell $argv[1]
set -l file $argv[2]
set -l code $argv[3]
set -l source
switch "$shell"
case bash zsh ksh
set source .
case '*'
tcr / gist:4416956
Last active Nov 29, 2017
Make a callable() object in all browsers and Node.js
View gist:4416956
if (!Object.__proto__) {
var sandbox = function () {
// create an <iframe>
var iframe = document.createElement("iframe"); = "none";
return frames[frames.length - 1];
var iframe = sandbox();
kaleb / XDG.vim
Last active Jan 17, 2022
VIM XDG Configuration
View XDG.vim
" XDG Environment For VIM
" =======================
" References
" ----------
" -
" -
if empty($XDG_CACHE_HOME)
jamescasbon /
Created Dec 11, 2011
Pure python templates using with statement
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
This module defines a template language that allows us to do:
d = Doc()
anonymous / Prelude.cs
Created Jul 16, 2011
Oh, you poor, poor imperative developers...
View Prelude.cs
/* Prelude.cs : What happens when a haskell programmer learns C#.
Copyright (c) 2011 Clark Gaebel
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
fcalderan / inception-javascript.js
Created Nov 2, 2010
inception explained as a 4 nested javascript closures
View inception-javascript.js
* Fabrizio Calderan, twitter @fcalderan, 2010.11.02
* I had an idea: could Inception movie be explained by a few javascript closures
* and variable resolution scope (just for fun)?
* Activate javascript console =)
<script>"inception movie");