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 "faraday" | |
require "json" | |
require "time" | |
require "csv" | |
require "mail" | |
require "active_support/all" | |
NHK_API_KEY = ENV['NHK_API_KEY'] |
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 "faraday" | |
require 'nokogiri' | |
class NdlSearch | |
def get_book_info(title, creator = nil) | |
data = [] | |
query = { | |
:mediatype => 1, | |
:cnt => 10 |
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 "nokogiri" | |
doc = Nokogiri::HTML(File.open("appearance_jp.html")) | |
doc.xpath('//form').first.xpath('.//input','.//select','.//textarea').each do |e| | |
puts "#{e.name}, type:#{e['type']}, name:#{e['name']}, class:#{e['class']}" | |
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
require 'icalendar' | |
require 'csv' | |
require 'optparse' | |
option={} | |
OptionParser.new do |opt| | |
opt.on('-f', '--file=VALUE', 'iCal(ics) file path') {|v| option[:ics_file] = v} | |
opt.on('-a', '--after=VALUE','after when: YYYY/mm/dd eg: -a 2015/11/22') {|v| option[:after_when] = v} | |
opt.parse!(ARGV) | |
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
let style = NSMutableParagraphStyle() | |
style.lineBreakMode =.ByWordWrapping | |
style.alignment = NSTextAlignment.Left | |
let stringAttrubute = [ | |
NSParagraphStyleAttributeName: style | |
] | |
let sampleText = "このStringは、このように...(略)...するようにしたい。途中で改行がはいるのである。\nどうすればいいのだろう?あ、できた!\nそして、まだまだStringは続く....(略)...." | |
sampleText.drawWithRect( | |
CGRectMake(0,0,800,300), | |
options: .UsesLineFragmentOrigin | .TruncatesLastVisibleLine, |
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
# samenames_html is html to display in popover | |
if (samenames_html.length > 0) { | |
$("#popoverSameNames").popover({ | |
title: '同姓同名があります.<span class="close">×</span>', | |
template: '<div class="popover" role="tooltip" style="width:500px;font-size:80%;"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"><div class="data-content"></div></div></div>', | |
html: true | |
}).on('shown.bs.popover', function(e){ | |
var popover = $(this); | |
$(this).parent().find('div.popover .close').on('click', function(e){ | |
popover.popover('hide'); |