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
DAKUTEN = "\u3099".freeze | |
HANDAKUTEN = "\u309A".freeze | |
BIND_LIST = { | |
"か#{DAKUTEN}" => "が", | |
"き#{DAKUTEN}" => "ぎ", | |
"く#{DAKUTEN}" => "ぐ", | |
"け#{DAKUTEN}" => "げ", | |
"こ#{DAKUTEN}" => "ご", | |
"さ#{DAKUTEN}" => "ざ", |
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 A | |
def foo | |
"foo" | |
end | |
end | |
class B < A | |
def foo_with_bar | |
"foo bar" | |
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
#!/usr/bin/env ruby | |
def ranks scores | |
rank = scores.sort.reverse | |
scores.map{|n| rank.index(n) + 1} | |
end | |
ranks([100, 80, 90, 90, 90, 70, 70, 80]) # => [1, 5, 2, 2, 2, 7, 7, 5] |
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 'thor' | |
class CuiAboutMeClient < Thor | |
ROOT_PATH = 'http://cui-about.me' | |
desc 'me', 'curl http://cui-about.me' | |
def me | |
system "curl #{ROOT_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
domain="http://example.com" | |
paths=("/" "/foo.html" "/bar.html" "baz.html") | |
for _path in ${paths[@]} | |
do | |
echo "\n"$domain$_path | |
time wget -o /dev/null -O /dev/null $domain$_path | |
done |
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
%script{type: "text/javascript", src: "http://maps.google.com/maps/api/js?sensor=false"} | |
:javascript | |
function addGeocode(){ | |
var geocoder = new google.maps.Geocoder(); | |
geocoder.geocode({'address': document.getElementById('place_address').value}, function(results, status) { | |
if (status == google.maps.GeocoderStatus.OK) { | |
// 緯度、経度を取得 | |
var lat = results[0].geometry.location.lat(); | |
var lng = results[0].geometry.location.lng(); | |
// 緯度、経度をhiddenパラメータを追加 |