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 Date | |
module Extender | |
module LastAndNext | |
['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'].each_with_index do |weekday, index| | |
define_method "last_#{weekday}" do | |
return self if wday == index | |
offset = wday - index | |
self - (offset < 0 ? offset + 7 : offset) | |
end | |
define_method "next_#{weekday}" 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
#! /bin/sh | |
if [ -z "$EDITOR" ]; then | |
echo "EDITOR is not set." | |
exit 1 | |
fi | |
TMPFILE="${TMPDIR}secuedit.$$" | |
NEW=0 |
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 HTTP | |
class BaseError < StandardError; end | |
class ClientError < BaseError; end | |
class BadRequest < ClientError; end | |
class Unauthorized < ClientError; end | |
class PaymentRequired < ClientError; end | |
class Forbidden < ClientError; end | |
class NotFound < ClientError; end | |
class MethodNotAllowed < ClientError; 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
<?php | |
class NP_CustomFilter extends NucleusPlugin { | |
function getName() { return 'NP_CustomFilter'; } | |
function getAuthor() { return 'Takatoshi -morimori- MORIYAMA'; } | |
function getURL() { return 'http://kray.jp/'; } | |
function getVersion() { return '1.0'; } | |
function getDescription() { return 'in template: <%CustomFilter(body,\'"<strong>".%s."</strong>"\')%>'; } | |
function supportsFeature($what) { | |
switch($what) { |
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
namespace :log do | |
desc "tail -f log/#{RAILS_ENV || 'development'}.log" | |
task :tail do | |
sh "tail -f log/#{RAILS_ENV || 'development'}.log" rescue RuntimeError | |
puts | |
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
=begin | |
http://doruby.kbmj.com/hogehoge/20100330/Ruby1.9_Rails_#p4 | |
ここの ActionController 用のパッチを Rails3 に対応させたもの | |
multipart の場合に正常に動くかは未確認 | |
=end | |
module ActionDispatch | |
module Http | |
module Parameters | |
private |
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.3p0 (2011-10-30 revision 33570) [x86_64-linux] | |
Rehearsal ------------------------------------------ | |
MD5 1.010000 0.000000 1.010000 ( 1.026340) | |
SHA1 1.710000 0.000000 1.710000 ( 1.724464) | |
SHA2 3.780000 0.000000 3.780000 ( 3.824757) | |
SHA256 3.460000 0.010000 3.470000 ( 3.498111) | |
--------------------------------- total: 9.970000sec | |
user system total real | |
MD5 1.020000 0.000000 1.020000 ( 1.025751) |
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 | |
# Run all specs | |
git stash --keep-index | |
RAILS_ENV=test bundle exec rake assets:precompile jasmine:headless assets:clean spec | |
result=$? | |
git stash pop | |
[ $result -ne 0 ] && exit $result |
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 | |
# 0. 設定 | |
RELEASE=1.kray | |
ARCH=i386 | |
EC2_PRIVATE_KEY=/path/to/private_key.pem | |
EC2_CERT=/path/to/certificate.pem | |
S3_BUCKET=bucket-name | |
AWS_ACCOUNT_NUMBER=012345678910 | |
AWS_ACCESS_KEY=youraccesskey |
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
find -type f -print0 | xargs -0 file | grep SQLite | awk -F : '{print $1}' | xargs -n1 -d "\n" sqlite_optimizer.sh |
OlderNewer