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 'httparty' | |
require 'time' | |
require 'active_support' | |
File.read("#{ENV['HOME']}/.gitconfig").match(/token = (\w+)/) | |
TOKEN = $1 | |
class Github | |
include HTTParty |
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
CmdUtils.CreateCommand({ | |
name: "delicious", | |
homepage: "http://ryan.codecrate.com/", | |
author: { name: "Ryan Sonnek", email: "[email protected]"}, | |
contributors: ["Ryan Sonnek"], | |
license: "MIT", | |
description: "Tags the current site using delicious", | |
icon: "http://delicious.com/favicon.ico", | |
help: "Save the current url to delicious with the tags input by the user. Any selected text on the page will be recorded as the note.", | |
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 'open-uri' | |
require 'xmlrpc/client' | |
require 'rexml/document' | |
require 'digest/md5' | |
require 'rubygems' | |
require 'json' | |
class SBM | |
# 初期設定 |
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 "openssl" | |
require "net/smtp" | |
Net::SMTP.class_eval do | |
private | |
def do_start(helodomain, user, secret, authtype) | |
raise IOError, 'SMTP session already started' if @started | |
check_auth_args user, secret, authtype if user or secret | |
sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) } |
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 'gruff' | |
class GitCommitGraph | |
Author = Struct.new(:name, :email) | |
Commit = Struct.new(:hash, :author, :time, :insertions, :deletions, :files_changed) | |
attr_accessor :time_spacing, :built, :repository, :since, :name, :commit_hash | |
attr_accessor :scale_type, :width, :height, :graph, :graph_type | |
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 'benchmark' | |
require 'facets/dictionary' | |
require 'rbtree' | |
n = 1000000 | |
Benchmark.bm do |x| | |
@h = Hash.new | |
x.report("Hash insert") { n.times do @h[rand(n)] = 1 end } | |
x.report("Hash access") { n.times do @h[rand(n)] 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
# NOTE: See further development and a gem at http://github.com/topfunky/basic_model | |
require 'couchrest' | |
## | |
# A minimal class to help use CouchDB and CouchRest with Rails. | |
# | |
# Provides dot notation access for all attributes, one level deep. | |
# | |
# note.title |
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
# A Sinatra App as a Rails Plugin | |
# | |
# In your Edge Rails app: | |
# | |
# ruby script/plugin install git://gist.github.com/50625.git | |
require 'sinatra/base' | |
class SinatraRailsPlugin < Sinatra::Base | |
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 'sinatra/metal' | |
class SinatraMetal < Sinatra::Base | |
include Sinatra::Metal | |
get '/sinatra' do | |
'hello sinatra!' | |
end | |
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
require 'sinatra/metal' | |
class SinatraMetal < Sinatra::Base | |
include Sinatra::Metal | |
get '/sinatra' do | |
'hello sinatra!' | |
end | |
end |
OlderNewer