Skip to content

Instantly share code, notes, and snippets.

View akm's full-sized avatar

Takeshi Akima akm

View GitHub Profile
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-script-type" content="text/javascript" />
</head>
<body>
<div style="float:right; font-size:x-small;max-width:40%;">
<%= yield(:page_outline) %>
#! /usr/bin/env ruby
require "optparse"
DEFAULT_OPTIONS = {
:layout => File.expand_path("./textile2html_layout.html.erb", File.dirname(__FILE__)),
:src_dir => File.expand_path("."),
:dest_dir => File.expand_path("."),
:noop => false,
:verbose => false,
}
@akm
akm / gemspec
Created November 13, 2010 15:08 — forked from defunkt/gemspec
#!/usr/bin/env ruby
# Usage: gemspec [-s] GEMNAME
#
# Prints a basic gemspec for GEMNAME based on your git-config info.
# If -s is passed, saves it as a GEMNAME.gemspec in the current
# directory. Otherwise prints to standard output.
#
# Once you check this gemspec into your project, releasing a new gem
# is dead simple:
#
@akm
akm / .emacs
Created July 7, 2010 05:18
.emacs
;; add load-path
(let ((dir (expand-file-name "~/.emacs.d/lisp")))
(if (member dir load-path) nil
(setq load-path (cons dir load-path))
(let ((default-directory dir))
(load (expand-file-name "subdirs.el") t t t))))
;; デフォルトの透明度を設定する (85%)
(add-to-list 'default-frame-alist '(alpha . 92))
obj = Object.new
def obj.foo(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
options = {:name=>"A", :no=>1}.update(options)
"#{args.inspect} #{options.inspect}"
end
# simply_stored
# gem install simply_stored right_aws uuidtools
require 'active_support'
require 'simply_stored/simpledb'
SimplyStored::Simple.aws_access_key = 'test1'
SimplyStored::Simple.aws_secret_access_key = 'test1'
conn = RightAws::ActiveSdb.establish_connection(
SimplyStored::Simple.aws_access_key,
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'gcalapi'
service = GoogleCalendar::Service.new("[email protected]", "*****")
calendar = GoogleCalendar::Calendar::new(service,
"http://www.google.com/calendar/feeds/[email protected]/private/full")
# 毎月18日がマイルストーン
#! /usr/bin/env ruby
require 'date'
STARTED_AT = DateTime.parse("Mon Apr 19 09:30:00 +0900 2010")
len = DateTime.now - STARTED_AT
t = Time.at((len * 24 * 60 * 60).to_i)
puts t.utc.strftime("#{len.to_i} days and %H:%M")
# HashKeyOrderable
# sort key and values for your order. MIT LICENCE. copyright Takeshi AKIMA 2010.
# http://gist.github.com/358709
module HashKeyOrderable
attr_accessor :key_order
def each_with_key_order(&block)
if @key_order.nil? || @key_order.empty?
each_without_key_order(&block)
return self
# http://doc.loveruby.net/refm/api/view/library/irb
# プロンプトモードは :DEFAULT の他に :NULL, :CLASSIC, :SIMPLE, :XMP が定義されています。
# 実行時には
# IRB.conf[:PROMPT].keys
# で確認できます。
# irb中で、
# conf.prompt_mode = :CODE
# とかすれば、モードの変更ができます。
IRB.conf[:PROMPT_MODE] = :SIMPLE