Skip to content

Instantly share code, notes, and snippets.

require 'formula'
class GitFlow < Formula
homepage 'https://github.com/banyan/gitflow'
# Use the tag instead of the tarball to get the submodule
url 'https://github.com/banyan/gitflow.git', :tag => '0.4.1'
version '0.4.1'
head 'https://github.com/banyan/gitflow.git', :branch => 'develop'
math.randomseed(os.time()) -- Declare otherwise it doesn't work as random
local input = io.open("foo.jpg", "rb");
local data = "";
if (input) then
while (true) do
local block = input:read(512); -- Read only 512 bytes per iteration
if (not block) then break; end
block = string.gsub(block, "0", math.random(11))
data = data..block
$ b rake
/Users/banyan/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [actionmailer-3.2.2, actionpack-3.2.2, activemodel-3.2.2, activerecord-3.2.2, activeresource-3.2.2, activesupport-3.2.2, addressable-2.2.7, archive-tar-minitar-0.5.2, arel-3.0.2, bcrypt-ruby-3.0.1, bson-1.6.1, builder-3.0.0, capybara-1.1.2, childprocess-0.3.1, columnize-0.3.6, diff-lcs-1.1.3, erubis-2.7.0, faraday-0.7.6, ffi-1.0.11, git-1.2.5, hike-1.2.1, i18n-0.6.0, jeweler-1.8.3, journey-1.0.3, json-1.6.6, linecache19-0.5.12, mail-2.4.4, mime-types-1.18, mongo-1.6.1, mongo_mapper-0.11.1, mongoid-2.4.7, multi_json-1.3.2, multipart-post-1.1.5, nokogiri-1.5.2, oauth-0.4.5, oauth2-0.5.2, plucky-0.4.4, polyglot-0.3.3, rack-1.4.1, rack-cache-1.2, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.2.2, railties-3.2.2, rake-0.9.2.2, rdoc-3.12, rspec-2.5.0, rspec-core-2.5.2, rspec-expectations-2.5.0, rspec-mocks-2.5.0, rspec-rails-2.5.0, ruby-debug-base19-0.11.25, ruby-debug19-0.11.6,
@banyan
banyan / gist:2481425
Created April 24, 2012 16:53
fizzbuzz for nginx-lua-module
location /fizzbuzz {
default_type 'text/plain';
content_by_lua '
for i = 1, 100 do
if i % 15 == 0 then
ngx.say("fizzbuzz");
elseif i % 5 == 0 then
ngx.say("buzz");
elseif i % 3 == 0 then
@banyan
banyan / gist:2472771
Created April 23, 2012 18:06
glitch-test
binary = File.binread("./foo.jpg")
File.binwrite("./bar.jpg", binary.gsub(/0/m, (rand(100)).to_s)) # ruby1.9.3 から File.binwrite が使える
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.rubygems.tunnels</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
puts [[1,2], [3,4]]
# =>
# 1
# 2
# 3
# 4
# Ruby で二次元配列に puts を実行すると、array.flatten.each{|v| p v } と同じような挙動になる
# 引数が配列の場合、その要素と改行を順に出力して、更に配列の場合は再帰的に実行する。
@banyan
banyan / jenkins.sh
Created February 27, 2012 01:53
Jenkins build 時間
# DURATION=`curl -s http://sample.com/job/sample_ruby-1.9.3-p125/95/api/xml | perl -le '$_=<>;/<duration>(.+?)</;printf $1'`
DURATION=`curl ${BUILD_URL}api/xml | perl -le '$_=<>;/<duration>(.+?)</;printf $1'`
total_sec=`expr $DURATION / 1000`
min=`expr $total_sec / 60`
sec=`expr $total_sec % 60`
if [ ${min} -eq 0 ];then
elapsed_time="${sec}sec"
else
elapsed_time="${min}min ${sec}sec"
@banyan
banyan / ignored.url
Created February 14, 2012 00:03
vichrome
http*://mail.google.com/*
http*://www.google.co*/reader/*
http*://docs.google.com/*
http*://www.google.com/calendar/*
http://reader.livedoor.com/reader/*