Skip to content

Instantly share code, notes, and snippets.

View elskwid's full-sized avatar
🤡

Don Morrison elskwid

🤡
View GitHub Profile
This tool is used to compare microbenchmarks across two versions of code. It's
paranoid about nulling out timing error, so the numbers should be meaningful.
It runs the benchmarks many times, scaling the iterations up if the benchmark
is extremely short, and it nulls out its own timing overhead while doing so. It
reports results graphically with a text interface in the terminal.
You first run it with --record, which generates a JSON dotfile with runtimes
for each of your benchmarks. Then you change the code and run again with
--compare, which re-runs and generates comparison plots between your recorded
and current times. In the example output, I did a --record on the master
@jgaskins
jgaskins / ar_model.rb
Created March 28, 2014 01:19
ActiveRecord default attributes
require 'active_record'
require 'pg'
ActiveRecord::Base.establish_connection host: 'localhost',
database: 'jamie',
adapter: 'postgresql'
class ARModel < ActiveRecord::Base
def initialize(attributes={})
# AR::Base#create w/o args passes nil because lol.

Reciprocal Needs in the Employment Relation

We can look at two sides of the management coin: What do the individuals get out of it? And what benefit does the whole system derive from it?

I will disregard any benefits that accrue to managers just by holding the position of managing. Those are just circular logic. Circular logic abounds in discussions of management and hierarchy. For example, consider status reports. It will be said that status reports are necessary so managers know what their employees are working on. It’s

@yorickpeterse
yorickpeterse / bench_node.sh
Created March 14, 2014 19:32
Accurate proof that Ruby is closer to the bear metal than Node.js
#!/usr/bin/env bash
siege -c 10 -b -t 30s http://localhost:9393

First, you install ruby-build and chruby. ruby-build is a program that knows how to download and build different ruby versions. chruby manages $PATH to control which ruby gets invoked in your shell. They work completely independently.

sudo su
cd /usr/src

git clone https://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
cd -
Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.
@mfpiccolo
mfpiccolo / vcr_dynamic.rb
Last active January 2, 2016 17:39
Dynamically creates the file structure and file naming for VCR cassettes with MiniTest::Spec
# Put this in your test helper
class MiniTest::Spec
before :each do |example|
if metadata[:vcr]
test_info = example.class.name.split("::").map {|e| e.underscore}.reject(&:empty?)
name = spec_name.underscore.gsub(/[^\w\/]+/, "_")
path = "test/cassettes/" + [(test_info[0] + "_test"), test_info[1]].join("/")
FileUtils.mkdir_p(path) unless File.exists?(path)
VCR.configure do |c|
@snormore
snormore / travisci-flowdock.md
Last active January 1, 2016 01:29
TravisCI Flowdock notificaitons for public repo and private flowdock rooms

TravisCI Flowdock notifications for public repo and private flowdock rooms

notifications:
@skade
skade / thoughts_on_microrb.md
Last active December 31, 2015 17:19
A few thoughts on microrb

Hi microrbes,

I gave the issue of "what would you like from microrb" a few thoughts that I'd like to write down here:

I find "building a collection" important, but that is one curated task for one or two persons. Still, I think this is selling the concept short.

I think there are a few things holding people off from using microlibraries:

  1. Inconsistent or lack documentation