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 -*- | |
numbers = [100, 100000500, 123456789] | |
numbers.each do |number| | |
scales = ["", "万", "億", "兆"] | |
puts number.to_s.gsub(/(\d)(?=(\d\d\d\d)+(?!\d))/, "\\1,").split(',').reverse.inject("") {|result, item| | |
scale = scales.shift | |
item = item.to_i.to_s.gsub(/(\d)(?=(?:\d\d\d)+(?!\d))/, '\1,') | |
result = item + scale + result unless item == "0" | |
result | |
} + '円' |
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
############################################# | |
### misc/standalone_cgi/bin/server | |
############################################# | |
kdmsnr:~# ab -n 100 -c 10 http://127.0.0.1:19292/index.rb | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 127.0.0.1 (be patient).....done |
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
blocked_lines = split_paragraph(lines).map {|i| ["<p>"] + i + ["</p>"] } |
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 -*- | |
# from: http://weed.cocolog-nifty.com/wzero3es/2010/03/090918-mixigmai.html | |
$KCODE = 'UTF-8' | |
require 'rubygems' | |
require 'mechanize' | |
require 'time' | |
class Mixi |
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 --git a/plugin/00default.rb b/plugin/00default.rb | |
index d52ee62..c04a912 100644 | |
--- a/plugin/00default.rb | |
+++ b/plugin/00default.rb | |
@@ -447,7 +447,7 @@ end | |
# make anchor string | |
# | |
def anchor( s ) | |
- if /^([\-\d]+)#?([pct]\d*)?$/ =~ s then | |
+ if /^([\-_\d]+)#?([pct]\d*)?$/ =~ s then |
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
checking for GCC... -------------------- yes | |
"/usr/bin/gcc-4.2 -o conftest -I/Users/kdmsnr/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/x86_64-darwin11.2.0 -I/Users/kdmsnr/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/Users/kdmsnr/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1 -I. -I'/Users/kdmsnr/.rbenv/versions/1.9.3-p0/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I'/Users/kdmsnr/.rbenv/versions/1.9.3-p0/include' -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -pipe conftest.c -L. -L/Users/kdmsnr/.rbenv/versions/1.9.3-p0/lib -L. -L'/Users/kdmsnr/.rbenv/versions/1.9.3-p0/lib' -L/usr/local/lib -lruby-static -lpthread -ldl -lobjc " | |
checked program was: | |
/* begin */ | |
1: #include "ruby.h" | |
2: | |
3: int main() {return 0;} | |
/* 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
# -*- coding: utf-8 -*- | |
ReVIEW::Compiler.defblock :tsv, 0..2, true | |
module ReVIEW | |
class Builder | |
# //tsv[ファイル名][キャプション] | |
def tsv(lines, id, caption = nil) | |
lines = File.open(id) | |
table(lines, id, caption) | |
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
module Kernel | |
def using(resource) | |
begin | |
yield | |
ensure | |
resource.dispose | |
end | |
end | |
def using2(resource) |
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
/Users/xxx/.nodebrew/node/v5.8.0/lib/node_modules/textlint/lib/task/textlint-core-task.js:13 | |
f (typeof superClass !== "function" && superClass !== null) { throw new TypeEr | |
^ | |
TypeError: Super expression must either be null or a function, not object | |
at _inherits (/Users/kdmsnr/.nodebrew/node/v5.8.0/lib/node_modules/textlint/lib/task/textlint-core-task.js:13:113) | |
at /Users/kdmsnr/.nodebrew/node/v5.8.0/lib/node_modules/textlint/lib/task/textlint-core-task.js:38:5 | |
at Object.<anonymous> (/Users/kdmsnr/.nodebrew/node/v5.8.0/lib/node_modules/textlint/lib/task/textlint-core-task.js:160:3) | |
at Module._compile (module.js:456:26) | |
at Object.Module._extensions..js (module.js:474:10) | |
at Module.load (module.js:356:32) |
OlderNewer