Skip to content

Instantly share code, notes, and snippets.

View banister's full-sized avatar
🇳🇱

John Mair banister

🇳🇱
View GitHub Profile
jViTBizGANaGywdZaYavwXUBWBuf5qQJVFVBQP6iaURq9veP87jsEBxCwX2ouY10
cWFL2RxOhWhKIkAj6aS8ZTVwliKBeTA2Mwb51mCfsXbUoupWGkmdtTyyVN0i
GQz2naCg+OGmAo8gysw1bIXKvqdTkIqrM1/ybBAKhD1EMFJhalChIYCv8PpD
uS8EFby+z5bTKJ6v/JXmORIylGZeAWLdF1LXGePx8xQCQA8/PlC8qAQJxf0vs0
iK2y2JAtSvcBwB9KGuNjOJ/IFsCSvnpQ92tM/t2vMnTQ9EUyGbse5Dhj7dgL
SCIK2E4RbSa5KFgIGyxBxQV4Y91/gmAE6Cf9WQ4Zo35E6oFQSIH73Xt5TxDouY
1n4yZGbf0Uu5/q5zkkcIV3Hb5UNs8or6iGylnRDiY3PBGSCPnP85roGD7DNp
ssrRXVq0+hgCdxSwN7j3zyTm9vAQ3A9xI0Re7PBXZ8ecXfWqXB1ph9b8oCKS6
tBlyTdFDGlbKcP/6yStHr/zWWDM1pgVr9uEPFBIVz/d+7KCe0oifb6B+8jGd
CTW5VzbtMyw6hImkDROwJ9BmVAjboUutMG0koI_31HKBRaaaaaaaaCmDwSGrQLRw
@gaearon
gaearon / slim-redux.js
Last active March 25, 2024 19:12
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
#include <stdio.h>
//; def int(*args); end
//; def main(*args, &block);
//; Object.class_eval { define_method("foo", &block) }; foo; end
//; def argc; end
//; def char; 3; end
//; def argv; 3; end
int main(int argc, char ** argv) {
@whylom
whylom / README.md
Created December 4, 2014 23:43
A parser for Heroku log messages

A parser for Heroku log messages

This parser uses the Parslet to define rules for parsing a log message in the simple key=value format used by Heroku, eg:

at=error code=H12 desc="Request timeout" method=GET path="/foo" dyno=web.3 connect=1ms service=30000ms status=503 bytes=0

Given a message in the above format, the parser returns a hash of the key/value pairs:

class UserCreator
def initialize(listener)
@listener = listener
end
def create(attributes)
user = User.new(attributes)
if user.save
# send email
alias.unstage=reset HEAD --
alias.br=branch
alias.co=checkout
alias.ci=commit
alias.last=log -1 -p HEAD
alias.fi=diff --name-only
alias.di=diff
alias.st=status -s --untracked=no
alias.dc=diff --cached
alias.rmc=rm --cached
%%% Monad.oz --- A synax that resembles Haskell's do notation for monads.
%% NB: The macros need to be evaluated before the examples can be run
declare Maybe Reader State Seq in
fun {Seq Monad A B}
{Monad.bind A fun {$ _} B end}
end
%% Syntax: return X
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active March 27, 2024 06:36
A badass list of frontend development resources I collected over time.
[1] pry(main)> class Hello
| def hello
| [__method__, __callee__]
| end
|
| alias_method :new_hello, :hello
| end
=> Hello
[2] pry(main)> Hello.new.hello
=> [:hello, :hello]
Program received signal SIGSEGV, Segmentation fault.
0x0000555555696a89 in VM_EP_LEP (ep=0xc) at vm.c:28
28 if (VM_EP_LEP_P(ep)) {
(gdb) bt
#0 0x0000555555696a89 in VM_EP_LEP (ep=0xc) at vm.c:28
#1 0x0000555555696ae1 in VM_CF_LEP (cfp=0x7ffff7fdeda8) at vm.c:44
#2 0x00005555556abeaa in rb_vm_make_env_object (th=0x5555559ec550, cfp=0x7ffff7fdeda8) at vm.c:490
#3 0x0000555555579644 in rb_binding_new_with_cfp (th=0x5555559ec550, src_cfp=0x7ffff7fdeda8) at proc.c:324
#4 0x00005555556b3063 in collect_caller_bindings_iseq (arg=0x7fffffff7e50, cfp=0x7ffff7fdeda8) at vm_backtrace.c:880
#5 0x00005555556b2222 in backtrace_each (th=0x5555559ec550, init=0x5555556b2ff6 <collect_caller_bindings_init>,