Hello
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 | |
# -*- coding: utf-8 -*- | |
require 'open-uri' | |
check = lambda {|i| open("http://www.pixiv.net/member.php?id=#{i}").read.index("該当ユーザーは既に退会したか、存在しないユーザーIDです")} | |
i=3600000 | |
loop do | |
print "#{i-=1000} " | |
break unless check.(i) |
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
var tiiki = ["hokkaido", | |
"aomori", | |
"iwate", | |
"miyagi", | |
"akita", | |
"yamagata", | |
"fukushima", | |
"ibaraki", | |
"tochigi", | |
"gunma", |
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 Hash; def &(x) self.merge(x) end 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
<?php | |
function getLabel($opt) | |
{ | |
$colors = Array(1=> "blue", 0=> "pink" ); | |
$namings = Array( "ちゃん", "くん", "さん", "君" ); | |
extract( array_merge(Array( "name"=> "", "sex"=> 0, "suffix"=>"", "coloring"=>"","school"=>false ), $opt) ); | |
$color = $colors[ $sex ]; | |
$naming = $names[ ($sex | (($age >= 12)*2)) ]; |
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
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zprofile | |
echo 'eval "$(rbenv init -)"' >> ~/.zprofile | |
git clone git://github.com/sstephenson/ruby-build.git | |
cd ruby-build | |
./install.sh | |
CONFIGURE_OPTS="--with-readline-dir=/usr/local" rbenv install 1.9.3-p0 | |
rbenv global 1.9.3-p0 | |
rbenv rehash |
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
def extract_tiny_url(url) | |
url = URI.parse(url) if url.is_a?String | |
TCPSocket.open(url.host, url.port) do|s| | |
s.write("GET #{url.path} HTTP/1.1") | |
s.write("\nHost: #{url.host}") | |
s.write("\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20100101 Firefox/11.0") | |
s.write("\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") | |
s.write("\nAccept-Language: ja-JP-mac,ja;q=0.8,en-US;q=0.5,en;q=0.3") | |
s.write("\n\n") | |
text = (s.readlines.join('').scan /URL=([a-z:\/\.\_0-9]*)/).flatten.first |
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 Enumerator | |
def filter(c=nil,&b) | |
s = self | |
e = ::Enumerator.new do |y| | |
s.each do |x| | |
y << (c||b).call(x) | |
end | |
end | |
return e unless c | |
e.each &b |
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 AccessLog | |
class Handler | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
session = env["rack.session"] && user_id = session["user_id"] | |
ipaddress = env["REMOTE_ADDR"] | |
user_agent = env["HTTP_USER_AGENT"] | |
referer = env["HTTP_REFERER"] |
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
(function() { | |
var tags = []; | |
var _tags = {}; | |
var words = document.documentElement.innerText.match(/[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]|[\uD840-\uD87F][\uDC00-\uDFFF]+|[\u12449-\u12531\u12540;]+|[a-zA-Z0-9!]+|[a-zA-Z>0-9]+/g); | |
words.forEach(function(word) { | |
if (word.length <= 3 || _tags[word]) { return ; } | |
_tags[ word ] = 0; | |
tags.push( word ); }); | |
delete _tags; | |
return tags; |
OlderNewer