This file contains 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
# Cucumber email_steps.rb for Merb | |
Given /^clear mailbox$/ do | |
Merb::Mailer.deliveries.clear.should == [] | |
end | |
Then /^I should receive (an|\d+) emails?$/ do |amount| | |
amount = 1 if amount == "an" | |
Merb::Mailer.deliveries.size.should == amount | |
end |
This file contains 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
var funcs = []; | |
for(var i=0; i<10; ++i) { | |
funcs[i] = function() { console.log(i); } | |
} | |
i = -1; | |
for(var ii=0; ii<10; ++ii) funcs[ii](); | |
// -1が10回表示 | |
This file contains 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 | |
# | |
# build AdHoc package | |
# | |
# Install: | |
# sudo gem install mechanize | |
# | |
# Usage: | |
# ruby build-adhoc.rb adhoc.yaml |
This file contains 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 'open3' | |
require 'rubygems' | |
require 'zip/zipfilesystem' | |
require 'fileutils' | |
module Tempdir | |
def self.path(&block) | |
result = path = nil | |
begin | |
path = File.join((ENV['TMPDIR'] || ENV['TMP'] || ENV['TEMP'] || '/tmp'), "temp.#{$$}.#{Time.now.to_f}") |
This file contains 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
=begin | |
geohash.rb | |
Geohash library for pure ruby | |
(c) 2009 Yuichiro MASUI | |
Distributed under the MIT License | |
move to http://github.com/masuidrive/pr_geohash | |
=end |
This file contains 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
=begin | |
東京付近のGeoHashの精度 | |
|文字数| 南北 | 東西 | | |
| 6| 609.08m| 988.77m| | |
| 7| 152.27m| 123.60m| | |
| 8| 19.03m| 30.90m| | |
| 9| 4.76m| 3.86m| | |
| 10| 0.59m| 0.97m| |
This file contains 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 encode(latitude, longitude, precision=12) | |
lat = [-90.0, 90.0] | |
lng = [-180.0, 180.0] | |
is_even = true | |
bit = ch = 0 | |
geohash = "" | |
while geohash.length < precision do | |
point = is_even ? lng : lat |
This file contains 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
yum install gcc zlib-devel rpm-build openssl-devel readline-devel nkf | |
wget http://futuremix.org/downloads/checkinstall-1.6.1-1.x86_64.rpm | |
rpm -ivh checkinstall-1.6.1-1.x86_64.rpm | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.bz2 | |
tar xfj ruby-1.8.7-p174.tar.bz2 | |
cd ruby-1.8.7-p174 | |
./configure --prefix=/usr --with-install-readline | |
make |
This file contains 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
#!/bin/sh | |
wget http://1978th.net/tokyocabinet/tokyocabinet-1.4.41.tar.gz | |
tar xvzf tokyocabinet-1.4.41.tar.gz | |
cd tokyocabinet-1.4.41 | |
./configure; make | |
sudo make install | |
cd .. | |
wget http://1978th.net/tokyodystopia/tokyodystopia-0.9.13.tar.gz | |
tar xvzf tokyodystopia-0.9.13.tar.gz |
This file contains 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
From f57d62514eb35da0f87c880bb888bd620729e23d Mon Sep 17 00:00:00 2001 | |
From: masuidrive <[email protected]> | |
Date: Wed, 10 Feb 2010 02:21:54 -0800 | |
Subject: [PATCH] Compile on space included directory | |
--- | |
wscript | 6 +++--- | |
1 files changed, 3 insertions(+), 3 deletions(-) | |
diff --git a/wscript b/wscript |