Skip to content

Instantly share code, notes, and snippets.

@yohfee
yohfee / juppon_anime.rb
Created November 10, 2011 16:07
Have a nice pocky day!
# coding: utf-8
require 'curses'
SPACE = ' '
BARS = ' | | | | | | | | | | '
NUMBERS = ' 1 2 3 4 5 6 7 8 9 1 0 '
BLANK = [
SPACE,
package org.yohfee.kantoroid;
import org.yohfee.kantoroid.GameEventListener;
public class Game {
private final GameEventListener listener;
private long score;
private float bonus;
private float prevX;
@yohfee
yohfee / awesome_print_mongoid.rb
Created May 18, 2011 09:35
Draft of awesome_print/lib/ap/mixin/mongoid.rb
module AwesomePrintMongoid
def self.included(base)
base.send :alias_method, :printable_without_mongoid, :printable
base.send :alias_method, :printable, :printable_with_mongoid
end
# Add Mongoid class names to the dispatcher pipeline.
#------------------------------------------------------------------------------
def printable_with_mongoid(object)
require 'mscorlib'
require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
require 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
include System::Net
include System::Text
include System::Windows::Forms
include System::Xml
class MyForm < Form
require 'mscorlib'
require 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
include System::Drawing
include System::Windows::Forms
class MyForm < Form
def initialize
button = Button.new
@yohfee
yohfee / image.rb
Created March 30, 2011 01:59
~/.earthquake/plugin/image.rb
#coding: utf-8
require 'open-uri'
require 'RMagick'
Earthquake.init do
command :image do |m|
url = m[1]
blob = open(url).read
image = Magick::Image.from_blob(blob).shift
@yohfee
yohfee / icon.rb
Created March 30, 2011 01:08
~/.earthquake/plugin/icon.rb
#coding: utf-8
require 'open-uri'
require 'RMagick'
Earthquake.init do
command :icon do |m|
url = twitter.show(m[1])["profile_image_url"]
blob = open(url).read
image = Magick::Image.from_blob(blob).shift
@yohfee
yohfee / notify.rb
Created March 23, 2011 07:11
~/.earthquake/plugin/notify.rb
#coding: utf-8
Earthquake.init do
config[:notify] = [/ruby/i, /#earthquake.gem/i]
output do |item|
next unless item["stream"]
if config[:notify].any?{|pattern| pattern =~ item["text"]}
notify item["text"], :title => item["user"]["screen_name"]
end
@yohfee
yohfee / zenra.rb
Created March 22, 2011 01:28
~/.earthquake/plugin/zenra.rb
#coding: utf-8
require 'open-uri'
require 'rexml/document'
Earthquake.init do
config[:zenra] = {
:appid => 'YOUR_YAHOO_APPID',
:position => '動詞',
:text => '全裸で',
@yohfee
yohfee / zenra.rb
Created March 19, 2011 01:56
/lib/earthquake/commands.rbの"init"ブロック内に追記
command :zenra do |m|
require 'open-uri'
require 'rexml/document'
sentence = m[1]
appid = 'YOUR_YAHOO_APPID'
position = '動詞'
text = '全裸で'
base_url = 'http://jlp.yahooapis.jp/MAService/V1/parse'