Skip to content

Instantly share code, notes, and snippets.

View unak's full-sized avatar

usa unak

View GitHub Profile
@unak
unak / history.txt
Last active November 29, 2021 01:40
The History of Ruby
* Only the releases of the stable versions are listed in principle. The releases of the unstable versions especially considered to be important are indicated as "not stable."
* The branches used as the source of each releases are specified, and the branching timing of them are also shown. BTW, before subversionizing of the repository, the term called "trunk" was not used, but this list uses it in order to avoid confusion.
* In order to show a historical backdrop, big conferences (RubyKaigi, RubyConf and Euruko) are also listed. About the venues of such conferences, general English notations are adopted, in my hope.
* ruby_1_8_7 branch was recut from v1_8_7 tag after the 1.8.7 release because of an accident.
* 1.2.1 release was canceled once, and the 2nd release called "repack" was performed. Although there were other examples similar to this, since the re-releases were performed during the same day, it does not write clearly in particular.
* Since 1.0 was released with the date in large quantities, the mi
@unak
unak / class.foo.patch
Last active December 31, 2015 00:19
※あとで消す 第2版。手抜き。ripper用コードはあってるかどうか知らん。
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
@unak
unak / constraint.rb
Last active October 26, 2019 17:29
type constraint
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)
(事務局(メール送信先)rubyprize@ruby.or.jp)
As follows recommendation format for Prize members
(Please contact us at rubyprize@ruby.or.jp)
------------------------------------------------------------------------------
Ruby Prize 2014 Recommendation Sheet
(Prize 会員用)
 氏名 姓             名
 ※CRuby Committerの方はSubversionのアカウント名をご記載ください
@unak
unak / show_dependency_tree_of_rails.rb
Created January 29, 2015 16:59
Show dependency tree of Rails
#!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 = []
#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;
@unak
unak / random_mapper.rb
Created March 22, 2015 17:46
中点変位法によるランダム地形生成器
#!ruby
require 'zlib'
PNG = 'sample.png'
WIDTH = 192
HEIGHT = 192
# 中点変位法による基礎データ生成
d = [WIDTH, HEIGHT].max
m = 1
class A
def initialize
p :A
end
end
class B < A
def initialize
p :B
end
@unak
unak / delete multi bench
Created April 4, 2016 15:49
the former is normal trunk, the latter is multi-delete patched
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
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[
熊本県天草・芦北地方
熊本県熊本地方
熊本県阿蘇地方
大分県西部