This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -rwebrick -e'WEBrick::HTTPServer.new(Port: 8000, DocumentRoot: Dir.pwd).start' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Net | |
class HTTP | |
alias_method '__initialize__', 'initialize' | |
def initialize(*args,&block) | |
__initialize__(*args, &block) | |
ensure | |
@debug_output = $stderr ### if ENV['HTTP_DEBUG'] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SSHKit::Backend::Netssh | |
alias_method :command_orig, :command | |
def command(*a) | |
@user = 'test2' # TODO replace with user to sudo to | |
command_orig(*a) | |
ensure | |
@user = nil | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
['mysql2', 'sequel', 'pp'].each(&method(:require)) | |
DB = Sequel.connect('mysql2://root@localhost/tmp') | |
DB.tables.each {|t| DB.drop_table(t) } | |
def t(name, columns, *rows) | |
DB.create_table(name) do | |
columns.each.with_index do |column, ind| | |
type = rows[0][ind].class.to_s | |
send type, column | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
module IRB | |
def self.before_eval | |
end | |
def self.after_eval | |
end | |
def self.around_eval(&block) | |
@timing = Benchmark.measure do | |
block.call | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= irb_callbacks | |
* http://rubysideshow.rubyforge.org/irb_callbacks | |
== DESCRIPTION: | |
This gem adds callbacks to irb, intended for you to | |
override at your discretion. | |
== FEATURES: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="420"> | |
<param name="movie" value="https://impdesk-cdn.s3.amazonaws.com/c5/63/01fa951290d8ccab15bae443cfcc.swf?1385464753" /> | |
<!--[if !IE]>--> | |
<object type="application/x-shockwave-flash" data="https://impdesk-cdn.s3.amazonaws.com/c5/63/01fa951290d8ccab15bae443cfcc.swf?1385464753" width="780" height="420"> | |
<!--<![endif]--> | |
<a target="_blank" href="http://example.com"> | |
<img | |
width="607" | |
height="367" | |
border="0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'bundler' | |
paths = Bundler.load.specs.map(&:full_gem_path) | |
system("ack '#{ARGV[0]}' #{paths.join(' ')}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local pid = io.open('/proc/self/stat'):read('*all'):gmatch('%d+')() | |
print(io.popen('ps -p ' .. pid .. ' -o cmd,vsz,rss'):read('*all')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module I18n | |
class JustRaiseExceptionHandler < ExceptionHandler | |
def call(exception, locale, key, options) | |
if exception.is_a?(MissingTranslation) | |
raise exception.to_exception | |
else | |
super | |
end | |
end | |
end |