Skip to content

Instantly share code, notes, and snippets.

View todesking's full-sized avatar
💀

todesking todesking

💀
View GitHub Profile
@todesking
todesking / gist:1104073
Created July 25, 2011 13:06
poor java DSL
addBatch(new Batch("hogehoge",new Batch.Serial() {{
add(HogeJob.class);
add(FugaJob.class);
add(new Batch.Parallel() {{
add(FooJob.class);
add(BarJob.class);
}};
}});
public enum NamedParam {
A(new Param1(1), new Param2("hoge")), B(new Param1(10), new Param2("fuga"));
X(Param1 p1, Param2 p2) {
this.p1 = p1.value;
this.p2 = p2.value;
}
public final int p1;
public final String p2;
@todesking
todesking / git-now
Created April 28, 2011 11:52 — forked from toshi-kawanishi/git-now
making convenient git commit
#!/bin/sh
set -e
PREFIX="from now"
MESSAGE="[${PREFIX}] `date`"
if [ $# -eq 0 ]
then
git add -u
@todesking
todesking / ResourceLeakChecker.java
Created January 21, 2011 04:30
明示的な開放を必要とするリソースが正しく開放されたかチェックする
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details. */
/**
* 明示的な開放が必要なリソースクラスが使用する。
*
* finalizeメソッドにより、開放されていないリソースがあった場合標準エラー出力に警告を出す。
@todesking
todesking / excel.rb
Created October 6, 2010 13:53
Wrapper for Excel OLE object
require 'win32ole'
require 'kconv'
module Excel
class OLEWrapper
def initialize obj
@obj=obj
end
def raw_obj
@obj
@todesking
todesking / twit_update_list.rb
Created October 1, 2010 04:38
Twitのお気に入りIDタブの設定を公式リストと同期させる
# Twitのお気に入りIDタブをlistと同期させる
# 使用法
# - リストと同期したいお気に入りIDタブの名前を list:リスト名 にする
# - Twitを終了する
# - このファイルをTwitのインストールフォルダに置き、実行するとリストがTwitに反映される
# - Twitを再起動
#
# 依存gem: Pit,twitter
# Pitに、'ユーザ名@twitter'という名前で以下の項目を登録しとく必要がある(てきとうにがんばってください)
# - consumer_token
@todesking
todesking / vividvim.vim
Created September 27, 2010 12:56
More vivid, interactive vim
let s:color='#ff0000'
function! s:fire()
if s:color == '#ff0000'
let s:color = '#0000ff'
elseif s:color == '#0000ff'
let s:color = '#00ff00'
elseif s:color == '#00ff00'
let s:color = '#ff0000'
endif
@todesking
todesking / gist:573510
Created September 10, 2010 11:57 — forked from sorah/gist:573131
1.upto(100){|i|puts i%3>0?i%5<1?:Buzz:i:i%5>0?:Fizz:'FizzBuzz'}
@todesking
todesking / redmine_set_default_values_on_new_ticket.user.js
Created July 6, 2010 12:33
Set default values on creating Redmine ticket
// ==UserScript==
// @name redmine_set_default_values_on_new_ticket
// @namespace http://d.hatena.ne.jp/gnarl/
// @include */issues/new*
// ==/UserScript==
(function() {
var SET_ASSIGNED_TO_IF_ONLY_ONE_USER=true;
var DEFAULT_TRACKER='2';
@todesking
todesking / redmine_add_100percent_done_button.user.js
Created July 6, 2010 11:49
Add 'Close as 100% done' button to Redmine
// ==UserScript==
// @name redmine_add_100percent_done_button
// @namespace http://d.hatena.ne.jp/gnarl/
// @include */issues/*
// ==/UserScript==
(function() {
// options
var SET_DUE_DATE_IF_EMPTY=true;