Skip to content

Instantly share code, notes, and snippets.

View closer's full-sized avatar
🦄
404

closer closer

🦄
404
View GitHub Profile
class Object
def say_ho
"Ho!"
end
def ho_ho
"Ho Ho!"
end
def ho_ho_ho
class Array
def chain m
r = shift
each{|n| r = r.send(m, n)}
r
end
end
class Range
def chain m
#!/usr/bin/ruby
require 'fileutils'
require 'open-uri'
require 'uri'
require 'digest/md5'
require 'rubygems'
require 'RMagick'
require 'simple-rss'
module Enumerable
def random
ary = self.to_a
ary[rand(ary.size)]
end
end
@closer
closer / random.rb
Created August 26, 2009 01:30
random select in ruby
module Kernel
def random arg
arg = arg.to_a if arg.class == Range
arg[rand(arg.size)]
end
end
class Range
def random
Kernel.random self
#!/usr/bun/ruby
require "fileutils"
require "pathname"
include FileUtils
SRC_BASE= Pathname.new ARGV.shift
DEST_BASE = Pathname.new ARGV.shift
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="icon" href="{Favicon}"/>
<link rel="alternate" type="application/rss+xml" title="RSS" href="{RSS}"/>
<title>{Title}{block:PostSummary} - {PostSummary}{/block:PostSummary}</title>
<style type="text/css">
* {
font-size:100%;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Tumblr Cascade</title>
<style type="text/css">
* {
font-size:100%;
}
#!/usr/bin/env ruby
require "kconv"
require "rubygems"
require "twitter"
require "mixi"
username = ''
password = ''
#!/usr/bin/ruby
# iTunes
require "rubygems"
require "rbosa"
class ControlliTunes
@@app = OSA.app('iTunes')