Skip to content

Instantly share code, notes, and snippets.

View mattraibert's full-sized avatar

Matt Raibert mattraibert

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mattraibert on github.
  • I am mattraibert (https://keybase.io/mattraibert) on keybase.
  • I have a public key ASCAlFPTPOWkQYSBFCY0lqvaODjZRzvfaAtCEBi_TIrvuQo

To claim this, I am signing this object:

CONNECTED(00000003)
depth=1 /C=BE/O=GlobalSign nv-sa/CN=GlobalSign Organization Validation CA - SHA256 - G2
verify error:num=20:unable to get local issuer certificate
verify return:0
OCSP response:
======================================
OCSP Response Data:
OCSP Response Status: successful (0x0)
Response Type: Basic OCSP Response
Version: 1 (0x0)

TL;DR (bash script edition)

If you want to get started quickly, run the following. Read below for more information.

brew install --cocoa --srgb emacs
brew install the_silver_searcher

mkdir -p tmp
pushd tmp
@mattraibert
mattraibert / hayuge.rb
Created November 2, 2012 04:27
Turn your tables into active record models
require 'active_record'
ActiveRecord::Base.establish_connection({:adapter => "mysql2", :username => "root", :password => "", :database => "hayuge_development"})
def show_tables
ActiveRecord::Base.connection.tables
end
def to_model_name table_name
table_name.split(?_).map(&:capitalize).join
@mattraibert
mattraibert / p.txt
Created October 21, 2012 01:59
parallelization benchmark results
ruby library n total
rbx none 1000 0.01
jruby none 1000 0.03
MRI1.9.3 none 1000 0.03
rbx peach 1000 0.04
rbx work_queue 1000 0.05
MRI1.9.3 work_queue 1000 0.17
jruby peach 1000 0.19
jruby work_queue 1000 0.32
MRI1.9.3 peach 1000 0.39
@mattraibert
mattraibert / p.rb
Created October 21, 2012 01:38
testing out parallelization in ruby
require 'benchmark'
require 'work_queue'
require 'peach'
require 'parallel'
arg = ARGV[0].to_i
Benchmark.bmbm do |x|
x.report("work_queue") do
wq = WorkQueue.new 4
@mattraibert
mattraibert / .gitconfig
Created October 3, 2012 18:06
some fancy git configs
[alias]
ci = commit -m
co = checkout
st = status
br = branch
di = diff
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
# show difference between the HEAD and the index
staged = diff --cached
@mattraibert
mattraibert / add to init.el
Created May 16, 2012 00:36
emacs autosave
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(auto-save-default t)
'(auto-save-interval 20)
'(auto-save-timeout 1)
;; this doesn't actually work
'(inhibit-clash-detection t)
module Properties
def property(property_name)
define_method(property_name) do
instance_variable_get("@#{property_name}".to_sym)
end
define_method("#{property_name}=".to_sym) do |value|
instance_variable_set("@#{property_name}".to_sym, value)
end
end
require 'minitest/autorun'
require 'properties'
class PropertiesTest < MiniTest::Unit::TestCase
class Foo
extend Properties
property :bar
end
def setup