This file contains 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 parse_table(raw) | |
raw.lines.map 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 | |
end | |
[key, values] | |
end.to_h |
This file contains 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
(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->> |
This file contains 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
empty-datomic-mem-db-setup | |
============================== | |
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 |
This file contains 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! RunTests(filename) | |
" Write the file and run tests for the given filename | |
:w | |
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 | |
else |
This file contains 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
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; | |
import java.io.IOException; | |
import java.net.InetSocketAddress; |
This file contains 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
irb(main):001:0> foo = RuntimeError | |
=> RuntimeError | |
irb(main):002:0> begin; raise RuntimeError.new; rescue foo; puts 'lol'; end | |
lol | |
=> nil |
This file contains 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
richard-p-fine-man-4:~(master!+) $ ruby -e "p gets" | |
^[[A | |
"\e[A\n" | |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
richard-p-fine-man-4:~(master!+) $ |
This file contains 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
#!/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 |
This file contains 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
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 vagrantup.com. |
This file contains 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
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 |
NewerOlder