Skip to content

Instantly share code, notes, and snippets.

View toland's full-sized avatar

Aeryn Toland toland

View GitHub Profile
(defmodule lfe_riak
(import (rename erlang ((list_to_binary 1) l2b))
(rename riak_object ((get_value 1) get))
(from lists (foreach 2) (map 2) (foldl 3))
(rename dict
((merge 3) make-merged-dict)
((new 0) make-dict)
((from_list 1) make-dict-from-list)
((to_list 1) make-list-from-dict)))
(export (hello 0)
@tpope
tpope / .inputrc
Created September 8, 2011 16:43
Basic amenities for vi readline bindings
set keymap vi-insert
Control-a: beginning-of-line
Control-b: backward-char
Control-d: delete-char
Control-e: end-of-line
Control-f: forward-char
Control-k: kill-line
Control-n: next-history
Control-p: previous-history
set keymap emacs-ctlx
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

-module(timeit).
-export([timeit/3,
timeit/4,
timeit/5]).
-export([simple_test/0]).
timeit(Mod, Fun, Arity) ->
timeit(all, Mod, Fun, Arity, undefined).
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@andrzejsliwa
andrzejsliwa / cowboy_debug.erl
Last active August 26, 2016 07:30
erlang - cowboy debugging helper request/response
%% See LICENSE for licensing information.
-module(cowboy_debug).
-export([onrequest_hook/1]).
-export([onresponse_hook/4]).
onrequest_hook(Req) ->
Method = to_string(extract(cowboy_req:method(Req))),
Path = to_string(extract(cowboy_req:path(Req))),
Params = params_to_string(extract(cowboy_req:qs_vals(Req))),
@andrzejsliwa
andrzejsliwa / emacs_indent.sh
Created October 25, 2012 17:54
erlang emacs-style formatting for vim
#!/usr/bin/env bash
emacs --batch --eval "
(progn (find-file \"$1\")
(if (string-equal \"darwin\" (symbol-name system-type))
(setq erlang-root-dir (car (file-expand-wildcards \"/usr/local/Cellar/erlang/R*\")))
(setq erlang-root-dir \"/usr/lib/erlang/\"))
(setq load-path (cons (car (file-expand-wildcards (concat erlang-root-dir \"/lib/erlang/lib/tools-*/emacs\"))) load-path))
(require 'erlang-start)
(erlang-mode)
(untabify (point-min) (point-max))
@kenkeiter
kenkeiter / guards.rb
Last active August 3, 2018 19:34
Guard-like things in Ruby
class Proc
def call_with_vars(vars, *args)
Struct.new(*vars.keys).new(*vars.values).instance_exec(*args, &self)
end
end
module Touchy
class GuardError < Exception; end
class GuardSignatureError < GuardError; end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.joshuaclayton.tmux_copy</string>
<key>ProgramArguments</key>
<array>
<string>/Users/joshuaclayton/.dotfiles/bin/tmux_copy</string>
</array>
@RJ
RJ / rabbit_boot_system.erl
Created November 8, 2012 22:38
RabbitMQ boot_step system
%% Boot system extracted from rabbitmq-server source code
%% The RabbitMQ license banner follows:
%%
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License
%% at http://www.mozilla.org/MPL/
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See