Skip to content

Instantly share code, notes, and snippets.

View yaotti's full-sized avatar

Hiroshige Umino yaotti

View GitHub Profile
@yaotti
yaotti / hoge.rb
Created August 5, 2011 03:34
test
def a
p 'a'
end
@yaotti
yaotti / start-work.sh
Created August 3, 2011 11:44
仕事初めshellscript
#!/bin/sh
branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /')
sha1=$(git log --since=yesterday -1 --format=%h)
echo "Start working at $(date '+%H:%M:%S')\nbranch: $branch(from:${sha1})"
@yaotti
yaotti / test.rb
Created August 1, 2011 16:45
Gist it
def hello
puts 'hello'
end
@yaotti
yaotti / get.rb
Created July 31, 2011 04:37
#ruby でobject.fieldを得るときに,objectがnilのときはnilを返して,そうでないときはobject.fieldを返すようなメソッドってあるのかな.NilClass.instance_methodsを見たけどそれらしいものはなかった
class User
attr_accessor :name
def initialize name=nil
self.name = name
end
end
me = User.new 'me'
p me.name.length # => 2
@yaotti
yaotti / hello.rb
Created July 31, 2011 04:16
Hello, new world!
def hello
p 'Hello, new world!'
end
@yaotti
yaotti / hoge.rb
Created July 31, 2011 03:31
ほげ
def a
p 'hoge'
end
@yaotti
yaotti / gist.rb
Created July 30, 2011 17:11
v3 APIを使ってGistに投稿する適当スクリプト
#!/usr/bin/env ruby
# a test script to post gist
# usage: GITHUB_TOKEN=xxxxxxx $0
require 'net/https'
require 'uri'
require 'json'
require 'pp'
uri = URI.parse("https://api.github.com/gists?access_token=#{ENV['GITHUB_TOKEN']}")
http = Net::HTTP.new(uri.host, uri.port)
@yaotti
yaotti / humu.rb
Created July 30, 2011 17:03
ふむー
def humu
p 'humu'
end
@yaotti
yaotti / hoge.rb
Created July 30, 2011 17:00
hoge
def hoge
p 'hoge'
end
require 'formula'
class Groonga < Formula
url 'http://packages.groonga.org/source/groonga/groonga-1.2.3.tar.gz'
homepage ''
md5 'f259e7a135965276e6750d0225a67cfc'
def install
# Apply the commit to support *BSD
# https://github.com/groonga/groonga/commit/6a6362a00df314c734dfdd40d59671b1b64e53df#diff-0