Skip to content

Instantly share code, notes, and snippets.

View tmaeda's full-sized avatar

tmaeda

  • Enishi Tech Inc.
  • Sapporo, Japan
View GitHub Profile
@tmaeda
tmaeda / beep_if_long_time_past
Last active December 19, 2015 03:29
.bashrc に書いておくと、コマンドの終了までに10秒以上かかったら growl で通知してくれるよ。
beep_if_long_time_past() {
LAST_COMMAND_DURATION=$(($(date +%s) - ${LAST_COMMAND_TIME}))
LAST_COMMAND=${BASH_COMMAND}
[[ ${LAST_COMMAND_DURATION} -gt 10 ]] && { growlnotify -a Terminal -t "job finished" -m "${LAST_COMMAND_DURATION} seconds for ${LAST_COMMAND}!"; }
export LAST_COMMAND_TIME=
}
export PROMPT_COMMAND=beep_if_long_time_past
trap '[ -z ${LAST_COMMAND_TIME} ] && export LAST_COMMAND_TIME=$(date +%s)' DEBUG
# とりあえず今のリスト
macair:test tmaeda$ milk list
bundle-milkode-1.0.0
nested_scaffold-0.2.1
*milkode* : 2 packages, 79 records in /Users/tmaeda/.milkode/db/milkode.db.
# rails を一旦uninstallしてみる
macair:test tmaeda$ gem uninstall rails
You have requested to uninstall the gem:
1.9.3p194> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1
=> 0.9999999999999999
$ ospec failures.ml
Failures
infix failure (FAILED: 1)
infix neg failure (FAILED: 2)
ident failure (FAILED: 3)
ident neg failure (FAILED: 4)
one arg ident failure (FAILED: 5)
one arg ident neg failure (FAILED: 6)
fun failure (FAILED: 7)
fun neg failure (FAILED: 8)
@tmaeda
tmaeda / gist:3754537
Created September 20, 2012 07:59
Procを再帰で呼べるかのテスト
def foo(ary)
rec = Proc.new do |ary|
if ary == []
next 0
else
rtn = ary[0] + rec.call(ary[1..-1])
next rtn
end
end
rec.call(ary)
@tmaeda
tmaeda / graph.rb
Created May 24, 2012 16:37
sprk2012 pull req graph
# sprk2012 pull req graph
require 'date'
require 'time'
require 'octokit'
client = Octokit::Client.new({:auto_traversal => true})
pulls = client.pulls("sprk2012/sprk2012-cfp")
days = (Date.new(2012,4,26)..Date.new(2012,5,25)).to_a.map{|d| [d.to_s, 0]}
@tmaeda
tmaeda / simplenote2momonote.rb
Created April 14, 2012 14:53
simplenote xml を momonote csv に変換
# -*- coding: utf-8 -*-
# simplenote xml を momonote csv に変換
require 'nokogiri'
require 'csv'
require 'time'
CSV.open("momonote.csv", "wb", {:col_sep => "\t", :row_sep => "\r\n"}) do |csv|
doc = Nokogiri::XML(File.read("simplenote_export_1.xml"))
doc.xpath("//note").each do |node|
@tmaeda
tmaeda / gist:2343618
Created April 9, 2012 13:59
SML#1.0.0 のmakeでエラーした。on Snow Leopard
precompiled/x86-darwin/274.s:428:suffix or operands invalid for `pop'
precompiled/x86-darwin/274.s:458:suffix or operands invalid for `pop'
precompiled/x86-darwin/274.s:459:suffix or operands invalid for `jmp'
precompiled/x86-darwin/274.s:464:suffix or operands invalid for `push'
precompiled/x86-darwin/274.s:494:suffix or operands invalid for `pop'
precompiled/x86-darwin/274.s:501:suffix or operands invalid for `push'
precompiled/x86-darwin/274.s:548:suffix or operands invalid for `pop'
precompiled/x86-darwin/274.s:554:suffix or operands invalid for `push'
precompiled/x86-darwin/274.s:569:suffix or operands invalid for `pop'
precompiled/x86-darwin/274.s:570:suffix or operands invalid for `jmp'
;;; .emacs.mac.el ---
;; Command-Key and Option-Key
(setq ns-command-modifier (quote meta))
(setq ns-alternate-modifier (quote super))
(when (and (eq window-system 'ns) (= emacs-major-version 23))
(set-fontset-font
(frame-parameter nil 'font)
'japanese-jisx0208
def foo()
puts "foo"
yield
end
a = 1
>> foo{ puts a; a += 1;}
foo
1