Skip to content

Instantly share code, notes, and snippets.

鹿の王(上下合本版) (角川書店単行本)
鶏むね、鶏もも、俺に任せろ! (レタスクラブMOOK)
Developer's Code 本物のプログラマがしていること
サーバサイドJavaScript Node.js入門 (アスキー書籍)
フルスクラッチから1日でCMSを作る シェルスクリプト高速開発手法入門 (アスキー書籍)
高速スケーラブル検索エンジン ElasticSearch Server
【全巻セット】機動警察パトレイバー 全5巻セット〈豪華特典版〉 (富士見ファンタジア文庫)
プログラマの考え方がおもしろいほど身につく本 問題解決能力を鍛えよう!
class KaraokeMachine
OCTAVE = %w(C C# D D# E F F# G G# A A# B)
def initialize(melody)
@melody = melody
end
def transpose(t)
transposed = transpose_octave(t)
@melody.gsub(/[A-G]#?/) do |m|
transposed[m]
crumb :oya do |oya|
link "Oya", oya_path(oya)
end
crumb :kodomo do |kodomo|
link "Kodomo", kodomo_path(kodomo)
parent :oya, kodomo.oya
end
crumb :mago do |mago|
@fukajun
fukajun / status.sql
Last active December 29, 2015 09:49
MYSQL
-- 接続ホスト接続数 接続時間
select left(host, 20) host_prefix, command, count(*), max(time)/3600 from INFORMATION_SCHEMA.PROCESSLIST group by host_prefix, command order by host_prefix;
require 'mandrill'
m = Mandrill::API.new
message = {
:subject=> "Hello from the Mandrill API",
:from_name=> "Your name",
:text=>"Hi message, how are you?",
:to=>[
{
:email=> "[email protected]",
:name=> "fukajun Test user"
@fukajun
fukajun / gist:5637228
Created May 23, 2013 16:05
AXLSXで入力規則を使用するためのサンプル
ws.add_data_validation("C12", { :type => :list, :formula1 => 'A1:A2', :showDropDown => true})
@fukajun
fukajun / gist:5242750
Last active December 15, 2015 09:59
色見本
- 16.times do |r|
- 16.times do |g|
- 16.times do |b|
- if (r + 1) % 4 == 0 && (g + 1) % 4 == 0 && (b + 1) % 4 == 0
%span{:style => "background-color:##{'%01x'%r + '%01x'%g + '%01x'%b}"}
hoge
- k = 0
- (0..15).each do |r|
@fukajun
fukajun / pre-commit
Last active December 15, 2015 08:29
git commit の時にRubyの古いスタイルのハッシュをチェックするフック
#!/bin/sh
echo "========Check old type hash statement========="
git diff --cached | grep ":[^ ]* *=> *:[^ ]*"
result=$?
ret=0
if [ $result -eq 0 ]; then
echo "!!!!!!!!Include old type hash statement!!!!!!!"
ret=1
fi
@fukajun
fukajun / gist:5226593
Created March 23, 2013 05:33
Install rsense
cd $HOME
mkdir -p lib/
wget http://cx4a.org/pub/rsense/rsense-0.3.zip
unzip rsense-0.3.zip
@fukajun
fukajun / gist:5142075
Last active December 14, 2015 20:09
和暦の日付選択
 module ApplicationHelper
   
   def date_select_ja(object_name, method, options = {}, html_options = {})
     t = date_select(object_name, method, options, html_options)
     t.gsub(/>([12]\d\d\d)</) do |m|
       year = m.match(/>(\d\d\d\d)</)[1].to_i
       wareki = case year
       when 0..1911 # 明治
         "明治#{year - 1867}"