Skip to content

Instantly share code, notes, and snippets.

def parse_table(raw) do |line|
parts = line.split(':')
key = parts.first.gsub(/^\$/, '')
values = parts.last.split(',').map(&:strip).map {|x| x.split("\t").map(&:strip) }.flatten
if values.count == 1
values = values.first
[key, values]
(deftype Failure [f])
(defn unwrap-fail [^Failure fail]
((.f fail)))
(defn fail? [potential-fail]
(isa? (class potential-fail) Failure))
;;TODO: extract into a new namespace, maybe an OS project?
(defmacro err->>
WARNING: Final GC required 5.030329259746849 % of runtime
Evaluation count : 322200 in 60 samples of 5370 calls.
Execution time mean : 204.316059 µs
Execution time std-deviation : 23.252812 µs
Execution time lower quantile : 185.144721 µs ( 2.5%)
Execution time upper quantile : 267.418129 µs (97.5%)
Overhead used : 1.833968 ns
function! RunTests(filename)
" Write the file and run tests for the given filename
if match(a:filename, '\.feature$') != -1
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
exec ":!bundle exec cucumber " . a:filename
elseif match(a:filename, '\.coffee$') != -1
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
exec "!jasmine-headless-webkit " . a.filename
import com.aphyr.riemann.client.EventDSL;
import com.aphyr.riemann.client.RiemannClient;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.*;
import com.yammer.metrics.stats.Snapshot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
irb(main):001:0> foo = RuntimeError
=> RuntimeError
irb(main):002:0> begin; raise; rescue foo; puts 'lol'; end
=> nil
richard-p-fine-man-4:~(master!+) $ ruby -e "p gets"
richard-p-fine-man-4:~(master!+) $
#!/usr/bin/env ruby -wKU
# encoding: UTF-8
# prints out the last 15 git branches you used
reflog = IO.popen('git reflog')
$branches = []
def add_branch(b)
$branches << b unless $branches.include? b
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at
set nocompatible
filetype off
silent! call pathogen#runtime_append_all_bundles()
silent! call pathogen#helptags()
filetype plugin indent on
runtime macros/matchit.vim
set hidden
set autoread
set nobackup