Skip to content

Instantly share code, notes, and snippets.

View tkfm-yamaguchi's full-sized avatar

Takafumi Yamaguchi tkfm-yamaguchi

View GitHub Profile
HDD の購入後チェック:
・購入直後にSMARTのチェック。
・WDのLifeGuardツールを使って、全体を0fill。
・再度SMARTのチェック。
・WDのLifeGuardツールを使って、全体を検査。
・再度SMARTのチェック。
・クイックフォーマット後に使用開始。
http://bbs.kakaku.com/bbs/K0000186013/SortID=15423934/#tab
@tkfm-yamaguchi
tkfm-yamaguchi / Rakefile
Created January 27, 2014 20:08
Git hash for rake
module Git
def self.current_hash
`git rev-parse --short HEAD`.chomp
end
end
task :hash do
puts Git.current_hash
end
@tkfm-yamaguchi
tkfm-yamaguchi / btsrp-gmap-fix.scss
Created January 6, 2014 10:37
Bootstrap(2.3) makes Google Map(v3)'s controller skinny
// http://stackoverflow.com/questions/9141249/twitter-bootstrap-css-affecting-google-maps
// Below fixes Bootstrap(2.3)'s affection to Google Map V3's control which would be skinny looks.
// '#map' is a container of Google Map.
#map {
img {
max-width: none;
}
label {
width: auto;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>closure pattern</title>
</head>
<body>
<div id="target1">
<h1>Target 1</h1>
</div>
###
# $ coffee -c loop.coffee ; nodejs loop.js
###
measure = (title, f) ->
begin = new Date()
f()
console.log "#{title}: #{(new Date() - begin)}"
times = 10000000
# coding: utf-8
require 'htmlentities'
coder = HTMLEntities.new
p coder.encode('Φ', :named) #=> '&Phi;'
p coder.decode('&phi;') #=> 'φ'
diff --git a/autoload/unite/sources/outline/defaults/ruby.vim b/autoload/unite/sources/outline/defaults/ruby.vim
index eb53c82..116bf81 100644
--- a/autoload/unite/sources/outline/defaults/ruby.vim
+++ b/autoload/unite/sources/outline/defaults/ruby.vim
@@ -19,6 +19,9 @@ function! unite#sources#outline#defaults#ruby#outline_info(...)
if path =~ '_spec\.rb$'
" RSpec
return 'ruby/rspec'
+ elseif path =~ 'Rakefile$' || path =~ '\.rake$'
+ " Rake
require 'rack'
# Because String#each has taken away since RUBY_VERSION >= 1.9,
# Rack::BodyProxy#each causes error ( and when 'use Rakc::CommonLogger' ).
# This is the monkey patch to fix it.
class String
def each(*args, &block)
each_line *args, &block
end
end
require "rubygems"
require "middleman-core/load_paths"
Middleman.setup_load_paths
require "middleman-core"
require "middleman-core/preview_server"
module Middleman::PreviewServer
def self.preview_in_rack
@tkfm-yamaguchi
tkfm-yamaguchi / fix_original_image_size_ acquisition_for_webkits.patch
Created November 17, 2013 21:19
Original : rwdImageMaps jQuery plugin v1.5 Chrome/Safari (webkit) で画像のロードに遅延が発生した場合など、画像のオリジナルサイズが正しく取得できないことがあったのを修正
--- pre.rwdImageMaps.js 2013-11-18 05:54:45.588799920 +0900
+++ post.rwdImageMaps.js 2013-11-18 05:53:19.692799931 +0900
@@ -37,6 +37,14 @@
h = temp.height;
}
+ // To get the natural width and height on Webkit, just use this.(width/height)
+ if (!w || !h) {
+ if (!w)
+ w = this.width;