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
# gem 'rake-hooks' # https://github.com/guillermo/rake-hooks | |
require 'rake/hooks' | |
after 'db:migrate' do | |
if Rails.env.development? | |
puts `annotate` | |
end | |
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
// require jquery | |
jQuery(function(){ | |
var WheelControl = { | |
_enabled: true, | |
enable: function(enabled) { | |
Aiming.WheelControl._enabled = enabled; | |
}, |
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 | |
text = <<EOS | |
# coding: utf-8 | |
'あ | |
あ' | |
EOS | |
require 'ripper' | |
Ripper.new(text).parse |
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
# "created_at/desc" とか書けるようにしていいなら(delimiter は相談.) | |
order_strings.map{|o| | |
name, order = o.split('/', 2) | |
column_names, | |
order = 'asc' if order != 'desc' | |
column_names.include?(name) ? "#{name} #{order}" : nil |
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
#!/bin/sh | |
function error() { | |
echo "'$1' has trailing spaces.\n" >&2 | |
} | |
git diff --cached --name-only | (while read f; do | |
ERROR=0 | |
if grep -n '[[:space:]]$' "$f" ; then | |
error $f |
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
# vim: ft=ruby fileencoding=utf-8 | |
# -------------------------------------------------- | |
# Notifier to screen | |
# -------------------------------------------------- | |
def hardstatus | |
status = open("#{ENV['HOME']}/.screenrc"){|f| f.grep(/^hardstatus/)[-1] } || "" | |
status.chomp.rstrip | |
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
# for model which includes 'acts_as_paranoid' | |
# example (for User class): | |
# describe "acts_as_taggable" do | |
# let (:scope) { Question } | |
# it_behaves_like 'soft delete' | |
# it_behaves_like 'with_deleted scopes' | |
# end | |
shared_examples_for "soft delete" do |
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
ruby-1.9.2-p290 :008 > bytes = open(filename, 'r:binary'){|f| f.read }; nil | |
=> nil | |
ruby-1.9.2-p290 :010 > bytes.encoding | |
=> #<Encoding:ASCII-8BIT> |
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
## Rails 3.2.1 (January 26, 2012) ## | |
* 変更なし |
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 ticketLink() { | |
// configuration | |
var sheetName = 'Sample1'; | |
var redmineUrl = 'http://redmine.example.com/issues/'; | |
var targetRange = 'A2:A'; | |
var doc = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = doc.getSheetByName(sheetName); | |
var all = sheet.getRange(targetRange); | |
var height = all.getHeight(); |