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
RSTRLEN_MAX = 50 | |
N = 10000 | |
# user system total real | |
# ana1 0.109000 0.000000 0.109000 ( 0.104961) | |
# ana2 0.078000 0.000000 0.078000 ( 0.074173) | |
require 'benchmark' | |
def ana1(s1, s2) |
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
require "open-uri" | |
URL = 'http://typhoon.yahoo.co.jp/weather/jp/earthquake/list/?sort=1&key=1&b=' | |
START = Time.local(2016,4,14,21,15,59) | |
GRAPH = 'test.tsv' | |
HEADERS = %w[ | |
熊本県天草・芦北地方 | |
熊本県熊本地方 | |
熊本県阿蘇地方 | |
大分県西部 |
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
D:\> type bench.rb | |
require 'benchmark' | |
REPEAT = 10_000_000 | |
Benchmark.bm do |x| | |
x.report do | |
REPEAT.times do | |
[1,2,3,4,5].delete(1) | |
end | |
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
class A | |
def initialize | |
p :A | |
end | |
end | |
class B < A | |
def initialize | |
p :B | |
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
#!ruby | |
require 'zlib' | |
PNG = 'sample.png' | |
WIDTH = 192 | |
HEIGHT = 192 | |
# 中点変位法による基礎データ生成 | |
d = [WIDTH, HEIGHT].max | |
m = 1 |
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
#define UNICODE | |
#include <windows.h> | |
#include <stdio.h> | |
int wmain(int argc, WCHAR **argv) | |
{ | |
BY_HANDLE_FILE_INFORMATION info; | |
WIN32_FILE_ATTRIBUTE_DATA attr; | |
int ret = 0; | |
HANDLE h; |
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
#!ruby | |
require "rubygems/dependency" | |
require "rubygems/spec_fetcher" | |
def fetch_spec(dep) | |
dep = Gem::Dependency.new(dep, :runtime) unless dep.is_a?(Gem::Dependency) | |
Gem::SpecFetcher.fetcher.spec_for_dependency(dep).first.map{|spec, src| spec}.last | |
end | |
$spec_cache = [] |
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
(事務局(メール送信先)[email protected]) | |
As follows recommendation format for Prize members | |
(Please contact us at [email protected]) | |
------------------------------------------------------------------------------ | |
Ruby Prize 2014 Recommendation Sheet | |
(Prize 会員用) | |
氏名 姓 名 | |
※CRuby Committerの方はSubversionのアカウント名をご記載ください |
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 Module | |
class ConstraintError < TypeError; end | |
def where(meth, constraint) | |
m = Module.new do | |
define_method(meth) do |*args| | |
args.zip(constraint.keys.first) do |arg, t| | |
raise ConstraintError, "type #{t} is expected, but #{arg.inspect} is passed" unless arg.is_a?(t) | |
end | |
ret = super(*args) |
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
Index: defs/id.def | |
=================================================================== | |
--- defs/id.def (リビジョン 44137) | |
+++ defs/id.def (作業コピー) | |
@@ -1,5 +1,6 @@ | |
# -*- mode: ruby; coding: us-ascii -*- | |
firstline, predefined = __LINE__+1, %[\ | |
+ class | |
freeze | |
inspect |