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 Sample2 < ActiveRecord::Base | |
validate :check_start_date_and_end_date | |
def check_start_date_and_end_date | |
if start_date.nil? | |
errors.add(:start_date, "start date should not be nil") | |
end | |
if end_date.nil? | |
errors.add(:end_date, "end date should not be nil") | |
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
def check_date | |
errors.add(:start_date, '開始時刻を入力してください') if start_date.nil? | |
errors.add(:end_date, '終了日を入力してください') if end_date.nil? | |
return unless errors.empty? | |
check_start_date_before_end_date(start_date, end_date) | |
check_start_date_and_end_date_gap(start_date, end_date) | |
end | |
def check_start_date_before_end_date(start_date, end_date) |
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
column "campaign name" do |resource| | |
c = Campaign.where(id: resource.campaign_id) | |
c.first.name if c.exists? | |
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
// ==UserScript== | |
// @name riaju | |
// @include http://* | |
// ==/UserScript== | |
document.body.innerHTML=document.body.innerHTML.replace(/リア充/g,'リア王'); |
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
// ==UserScript== | |
// @name city_hunter | |
// @include http://* | |
// ==/UserScript== | |
document.body.innerHTML=document.body.innerHTML.replace(/ほっこり/g,'もっこり'); |
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 | |
require 'optparse' | |
require 'net/http' | |
Net::HTTP.version_1_2 | |
class TwitterList | |
attr_accessor :user_name, :password, :list_name |
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/perl | |
use strict; | |
use warnings; | |
my $print_if_multiple_of = sub { | |
my ($str, $base) = @_; | |
return sub { | |
my $num = shift; |
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
let PLUGIN_INFO = | |
<VimperatorPlugin> | |
<name>fms_switcher</name> | |
<description>This script allows you to switch FireMobileSimulator status with Vimp CLI.</description> | |
<version>1.0.1</version> | |
<author>zentooo</author> | |
<license>Creative Commons</license> | |
<detail><![CDATA[ | |
== Subject == | |
This script allows you to switch FireMobileSimulator status from Vimperator CLI. |
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 dir(name, dir = nil) | |
dir ||= name | |
task name do | |
sh "tmux new-window -n #{name}"; | |
sh "tmux send-keys -t:#{name} 'cd #{dir}; clear' C-m"; | |
end | |
end | |
def perl(name, dir = nil) | |
dir ||= name |
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
use strict; | |
use warnings; | |
use YAML::XS; | |
use JSON::XS; | |
use Path::Class; | |
use Encode; | |
my $path = shift @ARGV; | |
my $obj = Load(decode('utf8', file($path)->slurp)); |
OlderNewer