Skip to content

Instantly share code, notes, and snippets.

@valvallow
valvallow / memoized-Y.scm
Created May 13, 2010 14:20
On Lisp, memoize, Y Combinator
(define memoized-Y
(let ((cache (make-hash-table 'equal?)))
(lambda (c)
((lambda (f)
(f f))
(lambda (g)
(c (lambda x
(let ((val (hash-table-get cache x #f)))
(if val val
((lambda (ret)
@briancavalier
briancavalier / promise-monad-proof.js
Created August 8, 2012 15:57
A proof that Promises/A is a Monad
//-------------------------------------------------------------
//
// Hypothesis:
//
// Promises/A is a Monad
//
// To be a Monad, it must provide at least:
// - A unit (aka return or mreturn) operation that creates a corresponding
// monadic value from a non-monadic value.
// - A bind operation that applies a function to a monadic value
@framon
framon / mvn.sh
Last active May 25, 2021 07:34
Show stack trace errors on console
mvn -Dsurefire.useFile=false -DtrimStackTrace=false test
@chewbakartik
chewbakartik / Gitlab-CI-Scripts
Last active September 16, 2015 16:47
Gitlab-CI - Build script per branch
# This is the script that is edited in the UI for Gitlab-CI
#
# $CI_BUILD_REF_NAME is provided by Gitlab-CI, it contains the branch the runner is working in.
branch=$CI_BUILD_REF_NAME
if [ $branch = "branch1" ]; then
bash deploy/branch1.sh
fi
@jroesch
jroesch / HList.idr
Created June 6, 2014 23:54
HList in Idris
using (x : Type, P : x -> Type)
data HList : (P : x -> Type) -> List x -> Type where
Nil : HList P []
(::) : {head : x} -> {tail : List x} -> P head -> HList P tail -> HList P (head :: tail)
head : {h : ty} -> {t : List ty} -> {P : ty -> Type} -> HList P (h :: t) -> P h
head (h :: _) = h
tail : {h : ty} -> {t : List ty} -> {P : ty -> Type} -> HList P (h :: t) -> HList P t
tail (_ :: t) = t
@jojobyte
jojobyte / ContextCmder-Disable.reg
Last active May 13, 2024 12:38
Cmder Context (Right-Click) Menu for Windows 7, 8, 10 & 11
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]

A Quick and Dirty Lens primer

Why does Lens exist? Well, Haskell records suck, for a number of reasons. I will enumerate them using this sample record.

data User = User { login    :: Text
                 , password :: ByteString
                 , email    :: Text
                 , created  :: UTCTime
 }
@TerrorJack
TerrorJack / gist:f1c5e26dab474927c756
Last active August 29, 2015 14:23
Haskell blogs worth reading

Haskell blogs worth reading

This is a (hopefully) short list of Haskell blogs I consider worth reading for intermediate Haskellers.

@paulirish
paulirish / what-forces-layout.md
Last active July 22, 2024 06:32
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@joshschmelzle
joshschmelzle / remap-capslock-to-control-win10.md
Last active May 13, 2024 01:55
Remap Caps Lock to Control on Windows 10

Ways to remap caps lock to control on Windows 10

These methods in this gist worked for me on my U.S.-based keyboard layouts. I am unsure about other layouts. If you have problems, revert your changes; delete the registry key you created (and reboot).

Update: you should probably scroll down to approach 4 where I suggest using Microsoft PowerToys Keyboard Manager.

Approach 1. Manually through regedit

Navigate to and create a new binary value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout named Scancode Map.