Skip to content

Instantly share code, notes, and snippets.

View kakutani's full-sized avatar

Kakutani Shintaro kakutani

View GitHub Profile
@kakutani
kakutani / gist:1381490
Created November 21, 2011 03:02
module_extended.rb
module M
def foo
puts "foo!"
end
end
class C
def eigen_class
class << self; self end
end
#!/usr/bin/env ruby
unless ARGV.size == 1
puts "specify screenname!"
exit 1
end
username = ARGV.shift
url = "http://api.twitter.com/1/users/profile_image/#{username}.json?size=bigger"
require 'open-uri'
img = open(url).read
@kakutani
kakutani / gist:1210976
Created September 12, 2011 10:29 — forked from jugyo/gist:756962
email_steps_ja.rb
# encoding: utf-8
# from: http://ukstudio.jp/2009/05/11/cucumber_email_spec_for_action_mailer/
Given /^(?:すべてのメールをクリアする|メールボックスが空になっている)$/ do
reset_mailer
end
# Use this step to open the most recently sent e-mail.
When /^メールを開く$/ do
@kakutani
kakutani / nesting.rb
Created August 15, 2011 12:31
nesting
module M
module Q
NESTING1 = Module.nesting
end
end
module M::Q
NESTING2 = Module.nesting
end
@kakutani
kakutani / wordbuf.c.patch
Created August 14, 2011 17:59
wordbuf.c
--- a/src/wordbuf.c 2011-08-15 02:57:05.000000000 +0900
+++ b/src/wordbuf.c 2011-08-15 02:57:17.000000000 +0900
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "wordbuf.h"
#define WORDLEN_DEF 64
@kakutani
kakutani / gist:1133493
Created August 9, 2011 06:03
gem contents docdiff
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/Makefile
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/devutil/JIS0208.TXT
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/devutil/char_by_charclass.rb
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/devutil/charclass_by_char.rb
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/devutil/jis0208.rb
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/devutil/testjis0208.rb
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/docdiff.conf.example
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/docdiff.gemspec
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/docdiff.rb
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/docdiff-0.4.0/docdiff/charstring.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'pit'
require 'mechanize'
require 'logger'
require 'uri'
require 'fileutils'
MY_DROPBOX_BASE="/path/to/your/dropbox/folder"
BASE_URL = 'https://esrv.org/jtrapja'
# -*- coding: utf-8 -*-
module Iso2022jpEnforcer
extend ActiveSupport::Concern
included do
default :charset => 'iso-2022-jp'
alias_method_chain :mail, :iso_2022_jp
end
module ClassMethods
module Depot
class EmailNotifier < Bluepill::Trigger
def initialize(process, options = {})
@to_address = options.delete(:to_address)
@from_address = options.delete(:from_address)
@notify_on = options.delete(:notify_on)
@rails_env = options.delete(:rails_env)
super
end
require 'formula'
class Cairo <Formula
url 'http://cairographics.org/releases/cairo-1.8.10.tar.gz'
homepage 'http://cairographics.org/'
md5 'b60a82f405f9400bbfdcf850b1728d25'
depends_on 'pkg-config' => :build
depends_on 'libpng'
depends_on 'pixman'