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 | |
require 'date' | |
# | |
# カレンダークラス | |
# | |
# 実装(予定)機能 | |
# (1)コンソールへの出力 ->○ | |
# (2)テーブル形式での出力 ->○ | |
# (3)休日を考慮 |
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
// String {{{ | |
String.prototype.trim = function() { | |
return this.replace(/^\s+|\s+$/g, ""); | |
} | |
String.prototype.ltrim = function() { | |
return this.replace(/^\s+/, ""); | |
} | |
String.prototype.rtrim = function() { | |
return this.replace(/\s+$/, ""); | |
} |
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
/* hoverの系の順序 */ | |
a:link { color: #999ea1 } | |
a:visited { color: #999ea1 } | |
a:hover { color: #999ea1 } | |
a:active { color: #999ea0 } |
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 ExtendBuiltInDataType | |
class ::Hash | |
def merge_apend_value(hash) #{{{ | |
self.update(hash) do |key, self_val, other_val| | |
Array.wrap(self_val).push(other_val) | |
end | |
end #}}} | |
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
$ -> | |
jQuery.extend jQuery.fn, | |
toggle_value: -> | |
obj = jQuery(this) | |
obj.val ((if obj.val() is "true" then "false" else "true")) | |
exists: -> | |
@length > 0 | |
enable: -> | |
$(this).removeAttr "disabled" | |
disabled: -> |
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 'find' | |
except_ext = %w(.log .yml .jpg .JPG .jpeg .png .pid .ttf .woff .md .json .ico .eot .gif) # 除外するファイル拡張子を設定 | |
except_pattern = %w(.git test .DS_Store migrate hankaku_kana_checker RackMultipart sprockets letter_opener underscore cache) # 除外するパスに含まれる文字列を指定 | |
# チェックする半角カナの配列 | |
han_kana = %w{ア イ ウ エ オ カ キ ク ケ コ サ シ ス セ ソ タ チ ツ テ ト ナ ニ ヌ ネ ノ ハ ヒ フ ヘ ホ マ ミ ム メ モ ヤ ユ ヨ ラ リ ル レ ロ ワ ヲ ン ァ ィ ゥ ェ ォ ャ ュ ョ ッ ゙ ゚ 、 。 ー 「 」} |
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 | |
require "aws-sdk" | |
S3_SAVE_DIR = "s3/" | |
ALL_FILE_DOWNLOAD = "全てのファイルを落とす" | |
s3 = AWS::S3.new( | |
access_key_id: "YOUR AWS ACCESS KEY" | |
secret_access_key: "YOUR AWS SECRET" |
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 Console | |
# Class Methods | |
class << self | |
def gets_from_stdin(message = nil) | |
print "#{message}: " unless message.nil? | |
str = STDIN.gets.chomp | |
end | |
def get_y_or_n_from_stdin(message) | |
bol = "" |
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
# http://stackoverflow.com/questions/6317705/rackrequest-how-do-i-get-all-headers | |
require 'rack' | |
app = Proc.new do |env| | |
headers = env.select {|k,v| k.start_with? 'HTTP_'} | |
.collect {|pair| [pair[0].sub(/^HTTP_/, ''), pair[1]]} | |
.collect {|pair| pair.join(": ") << "<br>"} | |
.sort | |
[200, {'Content-Type' => 'text/html'}, headers] | |
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
# lib/active_record/real_delete_discreetly.rb | |
module RealDeleteDiscreetly | |
extend ActiveSupport::Concern | |
def delete_discreetly | |
relation_exist = false | |
self.class.confirm_relations.each do |confirm_relation| | |
if destroyed_by_association | |
if destroyed_by_association.active_record == confirm_relation.to_s.classify.constantize | |
relation_exist = false |
OlderNewer