Skip to content

Instantly share code, notes, and snippets.

@siliconbrain
siliconbrain / Either.cs
Last active May 8, 2018 03:03
Implemetation of Haskell's Either type in C#
/// <summary>
/// Interface definition of Either
/// </summary>
/// <typeparam name="Tl">type of the Left value</typeparam>
/// <typeparam name="Tr">type of the Right value</typeparam>
public interface IEither<out Tl, out Tr>
{
/// <summary>
/// Check the type of the value held and invoke the matching handler function
/// </summary>
@eevee
eevee / disable_key_events.user.js
Last active August 29, 2015 14:03
userscript that blocks really really annoying js quirks. web devs should really do this crap themselves...
// ==UserScript==
// @name disable key events
// @namespace eev.ee
// @description Prevents JS on the page from receiving keyup, keydown, or keypress. Fixes, e.g., Twitter's disabling of shortcuts until the page has loaded.
// @include https://twitter.com/*
// @version 1
// @grant none
// @run-at document-start
// ==/UserScript==
@zph
zph / git-stats
Last active August 29, 2015 14:05
#!/usr/bin/env bash
set -eou pipefail
readonly BRANCH="$1"
readonly GIT_USER="$(git config --get user.email)"
# Thanks to @eevee
git log --pretty=tformat: --numstat --author="$GIT_USER" "$BRANCH" |awk -F '\t' '/./{a+=$1;r+=$2;f[$3]=1}END{printf"%d; +%d -%d = %d\n",length(f),a,r,a-r}'