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
# -*- coding: utf-8 -*- | |
Earthquake.init do | |
command %r{^:open\s+(\d+)\s+(\d+)$}, :as => :open do |m| | |
num = m[2].to_i | |
urls = URI.extract(twitter.status(m[1])['text']) | |
if !urls.empty? | |
if num <= urls.size | |
browse urls[num - 1] |
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
# config/initializers/active_record.rb | |
class ActiveRecord::Base | |
class << self | |
# 参考: http://techracho.bpsinc.jp/baba/2011_11_28/4729 | |
def define_unscoped_model(name, model, options = {}) | |
model_name = if options[:class_name] | |
options[:class_name].to_s | |
else |
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
curl -s -o /dev/null -I -w '%{url_effective}: %{http_code}\n' https://twitter.com/yan\[1-100\] |
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
#encoding: utf-8 | |
## config/deploy.rb | |
# pp | |
require 'pp' | |
# capistrano-ext | |
require "capistrano/ext/multistage" | |
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 | |
forwardings = { # sample | |
hoge: 'hoge.com -L 58010/10.120.1.10/3306', | |
fuga: 'fuga.org -L 58011/localhost/3306', | |
unko: 'unko.com -L 58012/222.222.222.222/3306' | |
} | |
forwardings.each do |k, v| |
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 | |
Dir[*ARGV].each do |f| | |
tmp = "#{File.dirname f}/_#{File.basename f}" | |
`iconv -c -f UTF-8-MAC -t UTF-8 #{f} > #{tmp}` | |
File.rename tmp, f | |
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
# -*- coding: utf-8 -*- | |
require 'yaml' | |
require 'json' | |
# 設定読み込み | |
@dir = File.dirname(__FILE__) | |
@env = ENV['APPLICATION_ENV'] || 'develop' | |
@config = YAML.load_file(ENV['RAKE_CONFIG_YAML'] || 'config/rake_config.yml')[@env] || {} | |
@db_config = JSON.load `php -r "require_once('app/Config/database.php'); echo json_encode((new DATABASE_CONFIG())->#{@env});"` |
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
autoload -U add-zsh-hook | |
# Growl notify long running command | |
__timetrack_threshold=20 # seconds | |
function __my_preexec_start_timetrack() { | |
local command=$1 | |
export __timetrack_start=`date +%s` |
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
$ -> | |
do init = (context = document)-> | |
$('.tabs[data-target]', context).each -> | |
$nav = $(@) | |
$tabs = $nav.find 'li' | |
$contents = $("##{$nav.data 'target'} > .tab_contents") | |
# default class | |
$nav.data 'class', $nav[0].className |
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
$ -> | |
$(document).on 'click', 'a.toggle', (ev)-> | |
ev.preventDefault() | |
$link = $ @ | |
$target = $ $link.attr 'href' | |
toggle_class = $link.data 'toggle-class' | |
if toggle_class | |
$target.toggleClass(toggle_class) |
OlderNewer