Skip to content

Instantly share code, notes, and snippets.

View vlado's full-sized avatar

Vlado Cingel vlado

View GitHub Profile
@vlado
vlado / example.rb
Created March 5, 2016 21:29 — forked from JoshCheek/example.rb
Debug
# https://minhajuddin.com/2016/03/03/put-this-in-your-code-to-debug-anything
require 'rouge'
require 'method_source'
require 'pp'
class Dbg
def initialize(object, to:)
@object, @stream = object, to
end
@vlado
vlado / gist:7713285
Last active December 29, 2015 18:49 — forked from ericboehs/gist:7125105
Fork of @ericboehs Poltergeist hack to silence CoreText performance notes from phantomjs My changes: 1. to is now optional parameter, if not provided @write_io is used 2. option to easily add more messages to suppress (I added this one WARNING: Method userSpaceScaleFactor in class NSView is deprecated)
module Capybara::Poltergeist
class Client
private
def redirect_stdout(to = nil)
to ||= @write_io
prev = STDOUT.dup
prev.autoclose = false
$stdout = to
STDOUT.reopen(to)