This file contains hidden or 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
1 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 LWP::UserAgent; | |
use File::Slurp; | |
use POSIX qw//; | |
my $ua = LWP::UserAgent->new; | |
my $resolv_conf_localhost = <<EOF; |
This file contains hidden or 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 Net::DNS::Nameserver; | |
my $ns = Net::DNS::Nameserver->new( | |
LocalPort => 53, | |
ReplyHandler => sub { print "query" }, | |
Verbose => 1, | |
) || die "couldn't create nameserver object\n"; |
This file contains hidden or 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.exports = function(grunt) { | |
var now = String(Date.now()); | |
var jsResult = "<%= dirs.js %>/target/" + now + ".js"; | |
var cssResult = "<%= dirs.css %>/target/" + now + ".css"; | |
var jsGzipped = jsResult + ".gz"; | |
var cssGzipped = cssResult + ".gz"; | |
var compressFiles = {}; | |
compressFiles[jsGzipped] = jsResult; |
This file contains hidden or 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<div class="a" onclick="this.parentNode.removeChild(this);">a - remove</div> | |
<div class="a" onclick="this.parentNode.appendChild(this.cloneNode(true));">a - clone</div> | |
<div class="a" onclick="this.appendChild(this.cloneNode(true));">a - appendChild</div> | |
<div class="b" onclick="this.parentNode.removeChild(this);">b - remove</div> |
This file contains hidden or 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 feature qw/say/; | |
our $_add = our $_remove = sub { | |
say "add and remove should be called in builder block!"; | |
}; |
This file contains hidden or 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($) { | |
var key = "__schema__"; | |
var attrMap = { | |
required: "required", | |
pattern: "pattern", | |
step: "divisibleBy", | |
min: "minimum", | |
max: "maximum", |
NewerOlder