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
def run(cmd) | |
`#{cmd}` | |
end | |
def run_spec(file) | |
unless File.exist?(file) | |
puts "#{file} does not exist" | |
return | |
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 -*- | |
class UrlValidator < ::ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
begin | |
uri = ::Addressable::URI.parse(value) | |
unless ["http", "https", "ftp"].include?(uri.scheme) | |
raise ::Addressable::URI::InvalidURIError | |
end | |
rescue ::Addressable::URI::InvalidURIError | |
record.errors[attribute] << "Invalid URL" |
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
{ | |
"font_face": "consolas", | |
"font_size": 12, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true | |
} |
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 | |
SIZE=262144 | |
MOUNT_POINT=/Volumes/ramdisk | |
RAM_DISK=`hdid -nomount ram://$SIZE` | |
newfs_hfs -v ramdisk $RAM_DISK | |
mkdir -p $MOUNT_POINT | |
mount -t hfs $RAM_DISK $MOUNT_POINT | |
chmod 0777 $MOUNT_POINT |
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 | |
# W | |
# R RW W. | |
# RW::::RW DR::R | |
# :RRRRRWWWWRt:::::::RRR::::::E jR | |
# R.::::::::::::::::::::::::::Ri jiR:::R | |
# R:::::::.RERRRRWWRERR,::::::Efi:::::::R GjRRR Rj | |
# R::::::.R R:::::::::::::;G RRj WWR RjRRRRj | |
# Rt::::WR RRWR R::::::::::::::::fWR::R; WRW RW R | |
# WWWWRR:::EWR E::W WRRW:::EWRRR::::::::: RRED WR RRW RR |
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 :spork do | |
desc "start spork in background" | |
task :start do | |
sh %{spork &} | |
end | |
desc "stop spork" | |
task :stop do | |
Process.kill(:TERM, `ps -ef | grep spork | grep -v grep | awk '{ print $2 }'`.to_i) | |
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
# | |
# Export development database(MySQL) data to sql file in order to | |
# import to production database(PostgreSQL) task specialized radiant. | |
# | |
# WARGNING: It should be configured database.yml also created databases | |
# both development and production and runned db:migrate before run tasks. | |
# MySQL database is already imported is needed. | |
# | |
# usage: rake db:convert:execute | |
# |
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
ja: | |
# extract from activesupport | |
date: | |
formats: | |
default: "%Y/%m/%d" | |
short: "%m/%d" | |
long: "%Y年%m月%d日(%a)" | |
day_names: [日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日] | |
abbr_day_names: [日, 月, 火, 水, 木, 金, 土] |
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 Ext | |
module Object | |
def self.included(base) | |
base.class_eval do | |
include InstanceMethods | |
end | |
end | |
module InstanceMethods | |
def current_method |
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 Ext | |
module WillPaginate | |
class RemoteLinkRenderer < ::WillPaginate::LinkRenderer | |
def page_link(page, text, attributes = {}) | |
@template.link_to_remote text, remote_url_for(page), attributes | |
end | |
protected | |
def remote_url_for(page) | |
{ :url => url_for(page), :update => @options[:update], :method => @options[:method] } |
NewerOlder