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 'formula' | |
class Elasticsearch < Formula | |
homepage 'http://www.elasticsearch.org' | |
url 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.0.Beta1.tar.gz' | |
sha1 'b2c7381368f8df57d10ce5fa18f55876d5d8969d' | |
head 'https://github.com/elasticsearch/elasticsearch.git' | |
depends_on 'maven' if build.head? |
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 'msgpack' | |
require 'pp' | |
while gets | |
line = $_.strip | |
begin | |
pp MessagePack.unpack(line) | |
rescue EOFError => e |
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 'capybara-webkit' # '~> 0.14.0' | |
require 'optparse' | |
require 'cgi' | |
options = {} | |
OptionParser.new do |opt_parser| | |
opt_parser.on('-O filename') {|value| options[:filename] = value } |
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
def destroy_all(conditions = nil) | |
if conditions | |
where(conditions).destroy_all | |
else | |
to_a.each {|object| object.destroy }.tap { reset } | |
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
source :forward | |
source(:http) { | |
port '8889' | |
} | |
foo_path = '/tmp/foo.log' | |
match(:file, 'heartbeat.**') { | |
path foo_path |
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 'timecop' | |
module ActiveRecordDetectTimeInScopes | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def scope(*args) | |
scope_caller = caller | |
Timecop.travel(Time.now) do | |
Timecop.top_stack_item.define_singleton_method :time do |
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
li.entry:not(.haiku2_default_text) { | |
display:none; | |
} | |
li.entry.one_comment { | |
display:block; | |
} | |
body { | |
min-height: 2000px; |
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
$ time ruby -S bundle _1.0.22_ exec ruby -e '' | |
ruby -S bundle _1.0.22_ exec ruby -e '' 1.50s user 0.25s system 95% cpu 1.829 total | |
$ time ruby -S bundle _1.1.0_ exec ruby -e '' | |
ruby -S bundle _1.1.0_ exec ruby -e '' 1.09s user 0.21s system 94% cpu 1.388 total |
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 'digest/sha1' | |
require 'pathname' | |
require 'open-uri' | |
require 'uri' | |
require 'nokogiri' | |
module PhotozouScraper | |
PHOTOZOU_URL = 'http://photozou.jp' |
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
def pbcopy(str) | |
IO.popen('pbcopy', 'r+') {|io| io.puts str } | |
output.puts "-- Copy to clipboard --\n#{str}" | |
end | |
Pry.config.commands.command "hiscopy", "History copy to clipboard" do |n| | |
pbcopy _pry_.input_array[n ? n.to_i : -1] | |
end | |
Pry.config.commands.command "copy", "Copy to clipboard" do |str| |