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
2つ目 |
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
public class SampleFormatDate { | |
public static void main( String[] args ) { | |
formatDate(); | |
} | |
public static void formatDate() { | |
Date d1 = Calendar.getInstance(Locale.JAPAN).getTime(); | |
// yyyy2013年2月7日木曜日 | |
SimpleDateFormat sdf = new SimpleDateFormat("'yyyy'yyyy年M月d日E曜日"); | |
System.out.println(sdf.format(d1)); |
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 subscribe(*args, &block) | |
p args | |
p block | |
args << {} unless args.last.is_a?(Hash) | |
p args | |
args.last.update(:block => block) | |
p args | |
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
Object.constants.sort.map { |e| | |
Object.const_get(e.to_s) | |
}.select { |e| | |
e.ancestors.include?(Exception) if e.class == Class | |
} |
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
describe 'テスト対象' do | |
context '状態' do | |
it '期待する出力' do | |
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
<<DATA.split.shuffle.each do |i| p i end | |
1 | |
2 | |
3 | |
DATA |
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
require 'open-uri' | |
require 'nokogiri' | |
page = Nokogiri::HTML(open('http://kzrb.doorkeeper.jp/events/8563')) | |
page.css('.user-name').children.to_a.shuffle.each do |name| | |
puts name.content | |
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
# Ignore bundler config. | |
/.bundle | |
# Ignore the default SQLite database. | |
/db/*.sqlite3 | |
/db/*.sqlite3-journal | |
# Ignore all logfiles and tempfiles. | |
/log/*.log | |
/tmp |
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
require 'uri' | |
require 'net/http' | |
tco = "https://t.co/DyfjrVazCG" | |
res = Net::HTTP.get_response(URI.parse(tco)) | |
p res["location"] |
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
require 'active_support/all' | |
target_day = Date.new(2014, 4) | |
month = target_day.beginning_of_month.upto(target_day.end_of_month) | |
month.each do |d| | |
puts "#{d} cwday: #{d.wday} wday: #{d.cwday} cweek: #{d.cweek}" | |
end | |
=begin | |
2014-04-01 cwday: 2 wday: 2 cweek: 14 |
OlderNewer