Skip to content

Instantly share code, notes, and snippets.

@hide24
hide24 / ember-ds.sh
Last active September 15, 2020 05:35
embernized GakuNin DS
#! /bin/bash
WAYF_URL="https://ds.gakunin.nii.ac.jp/WAYF/embedded-wayf.js"
LOCAL_FILENAME_BASE="embedded-wayf_js"
SUGGEST_URL="https://ds.gakunin.nii.ac.jp/GakuNinDS/incsearch/suggest.js"
SUGGEST_LOCAL_PATH="/ember_osf_web/suggest_js"
LOCALES=( ja en )
for locale in "${LOCALES[@]}"
do

Keybase proof

I hereby claim:

  • I am hide24 on github.
  • I am hidetoshi (https://keybase.io/hidetoshi) on keybase.
  • I have a public key ASBGr4PjwU7QL0yEbyJYSkNwPCWf_h6oMGYsuY8caIQY7Ao

To claim this, I am signing this object:

@hide24
hide24 / Hash#rdiff.rb
Created November 21, 2013 08:15
recursive different search from two version of transration_??.yml.
class Hash
def rdiff(other)
new_hash = {}
self.each do |key, value|
if other.key?(key)
if value.kind_of?(Hash)
if other[key].kind_of?(Hash)
diff = value.rdiff(other[key])
unless diff.empty?
new_hash[key] = diff
@hide24
hide24 / Hash#rdelete
Created November 21, 2013 06:25
recursive delete of Hash.
class Hash
def rdelete(other)
new_hash = {}
self.each do |key, value|
if other.key?(key)
if value.kind_of?(Hash)
if other[key].kind_of?(Hash)
new_hash[key] = value.rdelete(other[key])
if new_hash[key].empty?
new_hash.delete(key)
@hide24
hide24 / gist:6237720
Created August 15, 2013 02:32
ruby warrior level 9 適当に書き足したのでlv9では要らない機能もある。 全レベル対応したいけど、lv6(初手で後退して救出せねばならないやつ)対応が思いつかない。
class Player
def play_turn(warrior)
spaces = warrior.look
space = spaces.first
backwards = warrior.look(:backward)
health = warrior.health
if space.enemy?
warrior.attack!
elsif space.captive?
warrior.rescue!
@hide24
hide24 / gist:4166465
Created November 29, 2012 02:50
decode character reference
class String
def decode_sharacter_refernce
self.gsub(/&#(?:(\d*?)|(?:x([0-9a-f]{4})));/i){[($1)? $1.to_i: $2.to_i(16)].pack('U')}
end
end
'♪'.decode_sharacter_refernce
#=> "\342\231\252"
puts '♪'.decode_sharacter_refernce
#♪
@hide24
hide24 / gist:3712104
Created September 13, 2012 05:35
recursive merge of Hash
class Hash
def rmerge(other)
new_hash = {}
keys = (self.keys + other.keys).uniq
keys.each do |k|
if other.key?(k)
if self.key?(k) && self[k].kind_of?(Hash)
new_hash[k] = self[k].rmerge(other[k])
else