Skip to content

Instantly share code, notes, and snippets.

@sowawa
sowawa / sinachiku.rb
Created June 18, 2012 07:00 — forked from mattn/sinachiku.rb
sinatra on mruby
require 'HTTP'
require 'UV'
module Sinachiku
@routes = { 'GET' => [], 'POST' => [] }
def self.route(method, path, opts, &block)
@routes[method] << [path, opts, block]
end
def self.do(r)
@routes[r.method].each {|path|
@sowawa
sowawa / README.md
Created February 3, 2013 07:23
Gist urls
git clone git://gist.github.com/{gist_id}.git
@sowawa
sowawa / gist:5610150
Last active December 17, 2015 12:29
luhn check sum(ISO 7812)
"4242424242424242".reverse.chars.each_with_index.map{|ch, index| index.even? ? ch.to_i : (ch.to_i * 2) % 10 + (ch.to_i * 2) / 10 }.inject(:+) % 10 == 0