This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: UTF-8 | |
# emoji plugin(Emot gem version) | |
# ==== | |
# | |
# You can post Emoji easily! | |
# | |
# Usage | |
# ---- | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# manage plugins for earthquake.gem | |
# | |
# forked from: | |
# https://gist.github.com/milligramme/5253047 | |
# | |
# usage | |
# :manage_plugins show installed plugin | |
# :manage_plugins on <plugin_name> enable plugin | |
# :manage_plugins off <plugin_name> disable plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# flip plugin | |
# ==== | |
# | |
# You can post flip text or vertical text. | |
# | |
# Usage | |
# ---- | |
# | |
# :flip twitter # => "ɹəʇʇᴉʍʇ" | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rb_meth_list2html.rb -- generate Ruby method list html file | |
# Author:: keyes | |
require "rbutils" | |
require "erb" | |
RUBY_REF = "http://doc.okkez.net/#{RUBY_VERSION.delete('.')}/view/" | |
USEFUL_LINKS = | |
{"Standard Library" => "#{RUBY_REF}library", | |
"RAA" => "http://raa.ruby-lang.org/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph G { | |
rankdir=TB | |
node [shape=plaintext, fontsize=16] | |
A -> B -> C -> D -> E [style=dotted, arrowhead=none] | |
"Ruby1.9 Class Relation Map" [shape=plaintext, fontcolor=darkgreen, style=filled, fontsize=20] | |
node [shape=Mrecord, height=1.2, width=2, style=bold]; | |
class [label = "{<0> Class\nclass |<1> Instance methods}"]; | |
basic [label="{<0> BasicObject\nclass |<1> Instance methods}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "drb/drb" | |
DRb.start_service | |
$lists = DRbObject.new_with_uri('druby://192.168.1.3:12345') | |
Shoes.app :width => 250, :height => 300 do | |
flow do | |
@input = edit_line :width => 150 do |ed| | |
$lists[:client_line] = ed.text | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def drop_char(i) | |
self[0...i] + self[i+1..-1] | |
end | |
def trans_char(i) | |
self[0...i] + self[i+1] + self[i] + self[i+2..-1] | |
end | |
def alt_char(i, char) | |
self.drop_char(i).insert(i, char) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
require "open-uri" | |
module Enumerable | |
def take_by(nth) | |
sort_by { |elem| yield elem }.slice(0...nth) | |
end | |
end | |
class WordDictionary | |
include Enumerable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "sinatra" | |
get '/' do | |
@year = Time.now.year | |
@ycal = cal(@year) | |
erb :index | |
end | |
get '/:year' do |year| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/local/bin/ruby | |
require "rubygems" | |
require "exifr" | |
require "flickr" | |
require "pit" | |
class FlickrPhoto | |
def self.set_token(*args) | |
@@flickr = Flickr.new(*args) | |
if @@flickr.auth.token |