Skip to content

Instantly share code, notes, and snippets.

View suchi's full-sized avatar
👨‍💼

suchi suchi

👨‍💼
View GitHub Profile
@suchi
suchi / mc.cs
Created May 25, 2011 12:44
「プログラミング作法」The Practice of Programming MarkovChainのC#実装例(Generics不使用)
/* PoP 3 Markov Chain in C# */
/* 2003/02/17: suchi -- */
using System;
using System.IO;
using System.Collections;
using System.Text.RegularExpressions;
class Prefix {
const int MULTIPLIER = 31; // for hashcode
@suchi
suchi / compare_sample.rb
Created May 12, 2011 06:55
hamamatsu.rb#3 protectedなインスタンス変数getterを利用した比較
class Foo
include Comparable
def initialize(x, y)
@x = x
@y = y
end
def <=>(rhs)
return nil unless rhs.instance_of? Foo
@suchi
suchi / ipad2_alive.rb
Created April 27, 2011 09:27 — forked from mackato/ipad2_check.rb
iPad2を待ちながら
require 'open-uri'
WAIT = 180
loop do
begin
open('http://onlineshop.mb.softbank.jp/ols/html/model/ipad/')
puts "iPad2 online shop page opened!"
rescue Exception => e
unless e.to_s =~ /^403/
puts "iPad2 online shop status changed #{e}"
end
@suchi
suchi / YYYYMMDD.HHMMSS.bat
Created August 5, 2010 11:39
YYYYMMDD.HHMMSSという環境変数を生成する
: YYYYMMDD.HHMMSSを作成する
: うしろ3桁をカット
set TIMEHHMMSS0=%TIME:~0,-3%
: ':'を削除
set TIMEHHMMSS=%TIMEHHMMSS0::=%
: '/'を削除
set DATEYYYYMMDD=%DATE:/=%
set DATETIME=%DATEYYYYMMDD%.%TIMEHHMMSS%
: ' 'を0にする
set DATETIME=%DATETIME: =0%
@suchi
suchi / list_all_controllers.html.erb
Created June 23, 2009 01:46
登録されているadmin/以下のコントローラを表示する
<% ActionController::Routing.possible_controllers.sort.each {|c| %>
<%= link_to c.gsub(/^admin\//, "").camelize, :controller => c.to_sym %> |
<% } %>