Skip to content

Instantly share code, notes, and snippets.

View hsbt's full-sized avatar
🏠
Working from home

Hiroshi SHIBATA hsbt

🏠
Working from home
View GitHub Profile
@darashi
darashi / git_commit_header.rb
Created May 20, 2009 11:44
add X-Git-Commit header to Rack application
# Rack middleware to insert git commit id into http response header
# For Rails, put this script under RAILS_ROOT/config/initializers
module Rack
class GitCommitHeader
def initialize(app)
@app = app
c = `git rev-parse HEAD`.chomp
@commit = (c =~ /^[0-9a-f]{40}$/) ? c : nil
end
module MultiParameterAttributes
def filter_time(attributes, name)
attrs = attributes.collect do |key, value|
if key =~ /^#{Regexp.escape(name.to_s)}\((\d+)(\w)\)$/
[$1.to_i, value.send("to_#$2")]
end
end.compact.sort_by(&:first).map(&:last)
Time.zone.local(*attrs) unless attrs.empty?
end
require 'rubygems'
require 'ruby-prof'
RubyProf.start
result = RubyProf.stop
printer = RubyProf::FlatPrinter.new(result)
open('rubyprof.txt', 'w+') do |f|
printer.print(f, 0)
end
;; -*- mode: Emacs-Lisp; coding: utf-8-unix -*-
;;; migemo.el - Japanese incremental search trough dynamic pattern expansion
;; $Id: migemo.el.in,v 1.8 2006/09/22 08:43:33 shirai Exp $
;; Copyright (C) Satoru Takabayashi
;; Author: Satoru Takabayashi <satoru-t@is.aist-nara.ac.jp>
;; Keywords:
;; This file is free software; you can redistribute it and/or modify
gem 'rails3-generators'
gem 'mongoid', '>= 2.0.0.beta'
gem 'bson_ext'
gem 'haml'
gem 'hirb', :group => :development
gem 'what_methods', :group => :development
gem 'rspec-rails', '>= 2.0.0.beta', :group => :test
gem 'rr', :group => :test
;;; inao-mode.el --- major mode for writing inao manuscripts
;; Copyright (C) 2010 SAKURAI Masashi
;; Author: SAKURAI Masashi <m.sakurai at kiwanami.net>
;; Keywords: outlines, convenience
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
# Rack file for local Rubygems server, using YARD
require "rubygems"
require "yard"
libraries = {}
Gem.source_index.find_name('').each do |spec|
libraries[spec.name] ||= []
libraries[spec.name] << YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, nil, :gem)
end
@makoto
makoto / gist:566419
Created September 5, 2010 23:07
RubyKaigi must die (for at least once).
NOTE: This is English translation of "http://shyouhei.tumblr.com/post/145555071/ruby".
The theme of Ruby Kaigi 2011 is "The last RubyKaigi" and the chariman Takahashi apparently got the
inspiration from this blog which Urabe san wrote a year ago. I translated this so that non Japanese
speaker also understand the context of post RubyKaigi discussions going on in Japanese Ruby community.
あえて言うがRuby会議はそろそろ一回終わってみるべき。
RubyKaigi must die (for at least once).
Original title: Let me say that Ruby Kaigi should end for now.
昨日、松江のRuby World Conference 2010行ったんです。RWC2010。
そしたらなんか言ってることがめちゃくちゃ偏ってて聞いてられないんです。
で、よく見たらなんかスライド出てて
「期間、予算の都合からJavaに関しては実際に物を作ってのデータとりを行わず、
 論理的な見積り値の算出にとどめた。見積り値の算出は富士通のファンクションスケール法」
とか書いてあるんです。
もうね、アホかと。馬鹿かと。
お前らな、自社基準の想像上の生産性と比較して検証とかいってんじゃねーよ、ボケが。
論理的な見積り値だよ、論理的な見積り値。
なんかWeb初心者いるし。HTMLやJSに苦戦か。たいへんだな。
@hitode909
hitode909 / _up
Created October 2, 2010 04:18
上に行くcd
#compdef up
segments=$(perl -le '$p=$ENV{PWD};$p =~ tr/\// /; print $p')
_arguments "1:first:($segments)"