Skip to content

Instantly share code, notes, and snippets.

View brynary's full-sized avatar

Bryan Helmkamp brynary

View GitHub Profile
@brynary
brynary / code_locator.rb
Created July 19, 2012 17:39
This code was used by Code Climate to figure out where classes, modules and methods live
def in_module(name, file, line, last_line)
if Sexp === name then
name = case name.first
when :colon2 then
name = name.flatten
name.delete :const
name.delete :colon2
name.join("::")
when :colon3 then
name.last.to_s
def assert_select(*args, &block)
# Start with optional element followed by mandatory selector.
arg = args.shift
@selected ||= nil
if arg.is_a?(HTML::Node)
# First argument is a node (tag or text, but also HTML root),
# so we know what we're selecting from.
root = arg
arg = args.shift
@brynary
brynary / readme.md
Created September 27, 2011 15:53 — forked from ngauthier/readme.md
%h4 Utility Account Summary
%table.data-table
= @user_metrics.utility_accounts_summary.each_count do |name, count|
%tr
%th= name
%td= count
4: CC vm/llvm/jit.cpp
virtual memory exhausted: Cannot allocate memory
virtual memory exhausted: Cannot allocate memory
virtual memory exhausted: Cannot allocate memory
rake aborted!
Error compiling
(See full trace by running task with --trace)
Error: gcc -Ivm -Ivm/test/cxxtest -I. -pipe -Wall -fno-omit-frame-pointer -ggdb3 -Werror -DRBX_PROFILER -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O2 -DHAS_EXECINFO -DHAS_READLINE -DNDEBUG -D_GNU_SOURCE -fomit-frame-pointer -fPIC -Ivm/external_libs/llvm/include -DENABLE_LLVM -Ivm/external_libs/udis86 -Ivm/external_libs/libffi/include -Ivm/external_libs/libgdtoa -Ivm/external_libs/onig -Ivm/external_libs/libtommath -I/usr/local/include -I/opt/local/include -c -o vm/llvm/artifacts/jit.cpp.o vm/llvm/jit.cpp
$ ruby -Xprofile config/environment.rb
Total running time: 16.081484850000002s
% cumulative self self total
time seconds seconds calls ms/call ms/call name
------------------------------------------------------------
5.58 15.17 0.90 83845 0.01 0.18 Array#each
4.01 1.51 0.64 157930 0.00 0.01 Rubinius::IdentityMap#insert
2.95 0.47 0.47 831 0.57 0.57 Rubinius::CodeLoader#load_compiled_file
2.92 0.47 0.47 98 4.79 4.79 GC.collect_young
@brynary
brynary / git.rb
Created December 7, 2010 19:05
git:warn_unpushed_changes cap task
Capistrano::Configuration.instance(:must_exist).load do
namespace :git do
task :warn_unpushed_changes do
master_rev = `git rev-parse master`.strip
origin_master_rev = `git rev-parse origin/master`.strip
if master_rev != origin_master_rev
puts "*" * 80
answer = Capistrano::CLI.ui.ask(" You have local commits that have yet to be pushed to origin. Continue? (y/N)")
exit(1) unless answer.downcase == 'y'
$ rake run
(in /Users/bhelmkamp/p/active/minitest_bench)
[1/1] Isolating bacon (> 0).
mkdir -p test
mkdir -p test
mkdir -p test
mkdir -p test
mkdir -p test
mkdir -p test
mkdir -p test
From cdad3390406d7bf4b70c53122e622f877557861f Mon Sep 17 00:00:00 2001
From: Bryan Helmkamp <bryan@brynary.com>
Date: Mon, 19 Jul 2010 13:33:26 -0700
Subject: [PATCH] Extract ParameterFilter class from FilterParameters mixin
---
actionpack/lib/action_dispatch.rb | 1 +
.../lib/action_dispatch/http/filter_parameters.rb | 73 +++-----------------
.../lib/action_dispatch/http/parameter_filter.rb | 72 +++++++++++++++++++
actionpack/test/dispatch/request_test.rb | 8 +-
$ time gem install nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.4.1
1 gem installed
real 0m13.029s
user 0m14.228s
sys 0m1.792s