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 'json' | |
require 'nokogiri' | |
doc = Nokogiri::XML(File.read('./Groups.xml')) | |
result = doc.search('Group').map{|g| | |
{g: g.search('Name').text, ms: g.search('Members string').map(&:text)} | |
} | |
json = {} | |
result.map{|g|g[:ms]}.flatten.uniq.map{|u| |
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
japan = Spree::Country.create!(name: "Japan", iso3: "JPN", iso: "JP", iso_name: "JAPAN", id: "1", numcode: "392") | |
zone = Spree::Zone.create!(name: "Japan", id: "1", description: "Shipping and paying in Japan", | |
zone_members: [Spree::ZoneMember.new(zoneable: japan)]) | |
# order by http://ja.wikipedia.org/wiki/ISO_3166-2:JP | |
%w( | |
北海道 | |
青森県 岩手県 宮城県 秋田県 山形県 福島県 | |
茨城県 栃木県 群馬県 埼玉県 千葉県 東京都 神奈川県 | |
新潟県 富山県 石川県 福井県 山梨県 長野県 岐阜県 静岡県 愛知県 |
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
class RecursiveOpenStruct < OpenStruct | |
def new_ostruct_member(name) | |
name = name.to_sym | |
unless self.respond_to?(name) | |
class << self; self; end.class_eval do | |
define_method(name) { | |
v = @table[name] | |
case v | |
when Hash | |
RecursiveOpenStruct.new(v) |
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
#coding: utf-8 | |
require "bundler" | |
Bundler.setup | |
require "twitter" | |
require "pit" | |
pit = Pit.get("june29bot", :require => { | |
"consumer_key" => "consumer_key", | |
"consumer_secret" => "consumer_secret", | |
"oauth_token" => "oauth_token", |
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
# .zshrc | |
setopt prompt_subst | |
autoload -Uz colors | |
colors | |
autoload -Uz add-zsh-hook | |
# for vcs_info | |
function _precmd_vcs_info() { | |
LANG=en_US.UTF-8 vcs_info | |
} | |
add-zsh-hook precmd _precmd_vcs_info |
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
#coding:utf-8 | |
# Thanks to http://d.hatena.ne.jp/cuzic/20100101 | |
system191 = ["/usr/", "1.9.1", 100] | |
commands = %w(ruby irb gem rake rdoc testrb erb) | |
[system191].each do |dir, suffix, priority| | |
args = commands.map do |command| | |
link = "/usr/bin/#{command}" |
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
# vim:fileencoding=utf-8 | |
require 'logger' | |
require 'rubygems' | |
require 'bundler' | |
Bundler.setup(:processor) | |
require 'mq' | |
logger = Logger.new(ARGV[0]||STDOUT,20,1048576 * 20) | |
logger.info "Start" |
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
# vim:fileencoding=utf-8 | |
require 'cgi' | |
require 'rubygems' | |
require 'rmagick' | |
require 'haml' | |
module Jigokuno | |
class Aggregator | |
def initialize(directory) | |
@directory = directory |
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 'net/telnet' | |
require 'rubygems' | |
require 'json' | |
# for ruby 1.9.2-p0 | |
class Net::Telnet | |
def method_missing(m, *args, &block) | |
@sock.__send__(m, *args, &block) | |
end | |
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
diff -r 031cce8c6eff common/content/browser.js | |
--- a/common/content/browser.js Mon Oct 04 00:29:05 2010 +0200 | |
+++ b/common/content/browser.js Mon Oct 04 23:45:27 2010 +0900 | |
@@ -155,29 +155,59 @@ | |
mappings.add([modes.NORMAL], ["gu"], | |
"Go to parent directory", | |
function (count) { | |
- function isDirectory(url) { | |
- if (/^file:\/|^\//.test(url)) { | |
- let file = io.File(url); |