Skip to content

Instantly share code, notes, and snippets.

View ericbeland's full-sized avatar

Eric Beland ericbeland

View GitHub Profile
@ericbeland
ericbeland / log_require_calls.rb
Created February 23, 2011 12:24
Log all calls to require in Ruby
# Logs calls to require so if a required file is blowing up, you can
# see the last require and diagnose. If your app stops booting, can be handy to
# find what borked things.
require 'logger'
class Object
def require(file_name)
log = Logger.new(File.join(File.dirname(__FILE__), 'required.log'))
log.debug("requiring: #{file_name}")
@ericbeland
ericbeland / rspec_broken_link_check.rb
Created February 23, 2011 14:43
RSpec Matcher to Check All Links are Valid in a Rails View
@ericbeland
ericbeland / invisible_proxy_to_array.rb
Created February 23, 2011 16:57
Invisibly call methods on all array members
# The invisible proxy allows seamless calling of a method on all objects of an array.
# When an array is wrapped (passed into) one of these objects, you can call a function
# on all objects in the array with one line. Useful for dsl's and such.
class InvisibleProxyToArray
instance_methods.each do |m|
undef_method(m) unless m =~ /(^__|^nil\\?|object_id|^send)/
end
@ericbeland
ericbeland / gist:846482
Created February 27, 2011 20:05
Slow Down webdriver in Capybara (Monkeypatch for 0.1.3)
# This is a total hack to slow down webdriver in Capybara
# so you can more easily watch what is happening.
# paste this above the top of a Capybara Webdriver RSpec test if you need to debug something in slo-mo
require 'selenium-webdriver'
module ::Selenium::WebDriver::Remote
class Bridge
def execute(*args)
puts "---Starting run---"
threads = []
@mutex = Mutex.new
thread1_ids = []
thread2_ids = []
o = nil
a = nil
Model.new.foo
[
{
"_id": "55b11cb6a098e0004d6837c6",
"index": 0,
"guid": "24d21841-e3c6-40d3-ba16-c0b29c13ad47",
"isActive": true,
"balance": "$1,832.43",
"picture": "http://placehold.it/32x32",
"age": 38,
"eyeColor": "brown",
@ericbeland
ericbeland / tableissue.rb
Created March 10, 2019 13:20
Table Header Issue
if __FILE__ == $PROGRAM_NAME
require 'canis/core/util/app'
require 'canis/core/include/layouts/splitlayout'
App.new do
layout = SplitLayout.new :height => -1, :top_margin => 1, :bottom_margin => 1, :left_margin => 1
@form.layout_manager = layout
urls_table = table :print_footer => false, :name => "urls"
urls_table.columns = %w{url avg}
@ericbeland
ericbeland / igvita.har.json
Created May 10, 2019 02:13 — forked from igrigorik/igvita.har.json
Sample HAR capture of igvita.com homepage
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.1"
},
"pages": [
{
"startedDateTime": "2012-08-28T05:14:24.803Z",
@ericbeland
ericbeland / buildresults.txt
Created December 29, 2020 14:50
build failures
gradle build
> Task :browserup-proxy-core:test
com.browserup.bup.mitmproxy.ChainedProxyAuthTest > testMitmproxyUsesHttpsUpstreamProxy FAILED
javax.net.ssl.SSLHandshakeException at ChainedProxyAuthTest.groovy:174
Caused by: sun.security.validator.ValidatorException at ChainedProxyAuthTest.groovy:174
Caused by: sun.security.provider.certpath.SunCertPathBuilderException at ChainedProxyAuthTest.groovy:174
com.browserup.bup.mitmproxy.ChainedProxyAuthTest > testAutoProxyAuthSuccessful FAILED