This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aliases for git | |
alias g="git" | |
alias gad="git add" | |
alias gb="git branch -v" | |
alias gba="git branch -a" | |
alias gbl="git blame" | |
alias gbr="git branch -r" | |
alias gc="git commit -v" | |
alias gca="git commit -av" | |
alias gco="git checkout" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$KCODE = 'u' | |
require 'java' | |
include_class 'java.io.FileInputStream' | |
include_class 'org.apache.poi.hssf.usermodel.HSSFWorkbook' | |
def open_xls(filename) | |
input = FileInputStream.new filename | |
book = HSSFWorkbook.new input | |
input.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DoubleCtrlCTrapper | |
TOLERANCE = 3 | |
def self.tolerance?(sec) | |
sec < TOLERANCE | |
end | |
def self.freq?(current) | |
b = @last_trapped && tolerance?(current - @last_trapped) | |
@last_trapped = current | |
b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# ruby timer.rb 3m ramen_ok & | |
require 'time' | |
require 'date' | |
NOHUP_FLAG = '___nohup___' | |
def main(delay, message) | |
wait(parse_time(delay)) | |
notify(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>HTML5 Canvas</title> | |
<script src="3d.js" type="text/javascript"></script> | |
<style type="text/css"> | |
html, body, canvas { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; border: 0 } | |
textarea { display: none } | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" generate method skeleton from word under the cursor | |
nnoremap <silent> <C-k> mayiw`a}odef <C-[>poend<C-m><C-[><C-o> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# will_paginateのリンク描画のみ行う | |
module WillPaginate | |
module ViewHelpers | |
def prepare_renderer(collection) | |
renderer = WillPaginate::LinkRenderer.new | |
options = {}.symbolize_keys.reverse_merge WillPaginate::ViewHelpers.pagination_options | |
renderer.prepare collection, options, self | |
renderer | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Struct | |
unless self.respond_to? :org_new_for_access_instance_variable | |
class << self | |
alias_method :org_new_for_access_instance_variable, :new | |
def new(*ary, &block) | |
st = org_new_for_access_instance_variable(*ary, &block) | |
st.module_eval { | |
alias_method :org_init, :initialize | |
def initialize(*ary) | |
org_init(*ary) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'tempfile' | |
def main | |
user = ARGV[0] | |
remote = ARGV[1] | |
if user_existed?(user) | |
STDERR.puts "already exist user #{user}. do nothing." | |
exit 1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
function setTitle(elements) { | |
for (var i=0; i < elements.length; i++) { | |
elements[i].title = elements[i].name; | |
} | |
} | |
var elements = document.getElementsByTagName('input'); | |
setTitle(elements); | |
elements = document.getElementsByTagName('select'); |
OlderNewer