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 | |
# coding: utf-8 | |
require "rubygems" | |
require "net/http" | |
require "nokogiri" | |
class ShindanMaker | |
attr_accessor :user, :yomi, :path |
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 | |
# coding: utf-8 | |
class AvoidSearch | |
Delimiter = "!\"#\$%&'()-=^~\|@`[{;+:*]},<.>/?\\_" | |
def initialize(word="", sym="") | |
@word = word.split(//) | |
@sym = sym | |
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
*[ruby][irb]IRBソースコードリーディング | |
**対象 | |
-ruby 1.9.2-p0 | |
**ファイル構成 | |
今回は以下のファイルを対象とします。 | |
ruby-1.9.2-p0/lib | |
|-- irb.rb | |
`-- irb/ |
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
# macports | |
sudo port selfupgrade | |
port oudated | |
sudo port upgrade outdated | |
# rvm | |
rvm get latest | |
rvm reload | |
# ruby |
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 | |
# coding: utf-8 | |
require "firewatir" | |
require "notify" | |
b = Watir::Browser.new | |
user = "ohnishiakira" # 入力する名前 | |
user_ja = "おおにしあきら" # 発音する名前 |
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
function check-shell-command { | |
if [ $? -eq 0 ]; then | |
echo "(^_^)" | |
else | |
echo "(+_+)" | |
fi | |
} | |
PS1='$(check-shell-command):\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
// ==UserScript== | |
// @match http://b.hatena.ne.jp/* | |
// ==/UserScript== | |
var title = [ | |
document.querySelectorAll(".entry-link"), | |
document.querySelectorAll(".asin-sim-title") | |
]; | |
for (var i = 0, k = title.length; i < k; i++) { | |
for (var j = 0, l = title[i].length; j < l; j++) { |
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
/* | |
* http://www.w3.org/TR/ElementTraversal/ にある | |
* - firstElementChild | |
* - nextElementSibling | |
* - childElementCount | |
* を使ったサンプル | |
*/ | |
function traverseTree(element, indent) { | |
var tagName = element.tagName; | |
var child = element.firstElementChild; |
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 ary = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; | |
// 普通の書き方 | |
for (var i = 0; i < 10; i++) { console.log(ary[i]); } | |
// こう書くとループ内がシンプルになる。その分 for (...) の部分が長くなるけど。 | |
for (var i = 0, a = 0; i < 10; i++, a = ary[i]) { console.log(a); } |
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 | |
# coding: utf-8 | |
class String | |
def to_dvd | |
return nil if self.length != 3 | |
(self.split(//).join("・") + "!") * 2 | |
end | |
end |
OlderNewer