Find it here: https://github.com/bitemyapp/learnhaskell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <chrono> | |
constexpr auto operator "" _days (unsigned long long n) { return std::chrono::hours(24 * n); } | |
constexpr auto operator "" _h (unsigned long long n) { return std::chrono::hours(n); } | |
constexpr auto operator "" _min (unsigned long long n) { return std::chrono::minutes(n); } | |
constexpr auto operator "" _s (unsigned long long n) { return std::chrono::seconds(n); } | |
constexpr auto operator "" _ms (unsigned long long n) { return std::chrono::milliseconds(n); } | |
constexpr auto operator "" _µs (unsigned long long n) { return std::chrono::microseconds(n); } | |
constexpr auto operator "" _ns (unsigned long long n) { return std::chrono::nanoseconds(n); } |
ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Monad | |
import Control.Monad.ST | |
import Data.Array.ST | |
import Data.Array.Unboxed | |
import Criterion.Main (defaultMain, bgroup, bench, whnf) | |
import Debug.Trace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Public domain. | |
// Attribution welcome, but not required. -- Pyry Jahkola. | |
// What's the point in all this? To get the equivalent of CoffeeScript's | |
// (?.) operator into vanilla JavaScript. | |
// get(x, key1, key2, ...) -- Get the result of x[key1][key2]..., or undefined. | |
// Will short circuit if a key is not found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_holiday(d): | |
"""Check whether the given dateutil.date is a Finnish national holiday""" | |
import dateutil.easter | |
from datetime import date, timedelta as td | |
assert isinstance(d, date) | |
md = '{}.{}'.format(d.day, d.month) | |
y = d.year | |
# Fixed-date holidays | |
if md in '1.1 6.1 1.5 6.12 24.12 25.12 26.12'.split(): return True | |
# Finnish midsummer (eve on Fri the 19..25th, day on Sat the 20..26th) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following code is in public domain. Re-releases are free to choose | |
// whether to attribute the code to its original author or not. | |
// Author: Pyry Jahkola <[email protected]> | |
#include <sstream> | |
#include <iostream> | |
#include <map> | |
#include <cassert> | |
#include <stack> | |
#include <vector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function git-ps1 { | |
case $1 in | |
y|yes|on) | |
export GIT_PS1_SHOWDIRTYSTATE=yes | |
export GIT_PS1_SHOWUNTRACKEDFILES=yes | |
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then | |
export PS1='\[\e[0m\e[36m\]\u@\h \[\e[1;39m\]\w\[\e[0;32m\]$(__git_ps1 " (%s)")\[\e[0m\] \\$ '; | |
else | |
export PS1='\[\e[0m\e[31m\]\u \[\e[1;39m\]\w\[\e[0;32m\]$(__git_ps1 " (%s)")\[\e[0m\] \\$ '; | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
l50 = "!f () { git log --abbrev-commit --date=short --pretty=format:'%h%x00%cd%x00%s%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"\\033[31m%s\\033[0m \\033[32m%s\\033[0m %-50s \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5 }' | less -R; }; f" | |
l80 = "!f () { git log --abbrev-commit --date=short --pretty=format:'%h%x00%cd%x00%s%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"\\033[31m%s\\033[0m \\033[32m%s\\033[0m %-80s \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{79}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5 }' | less -R; }; f" | |
lg50 = "!f () { git log --graph --color=always --abbrev-commit --date=relative --pretty=format:'%x00%h%x00%s%x00%cd%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"%s\\033[31m%s\\033[0m %-50s \\033[32m%14s\\033[0m \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5, $6 }' | less -R; }; f" | |
lg80 = "!f () { git log --graph --color=always --abbrev-commit --date=re |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSObject+BlockObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// [email protected] | |
// Public domain because I love you. Let me know how you use it. | |
// | |
#import <Cocoa/Cocoa.h> |