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
| package info.bouzuya.booklog; | |
| import java.io.IOException; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; | |
| import org.jsoup.Jsoup; | |
| import org.jsoup.nodes.Document; |
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
| package net.bouzuya.bim.matchers; | |
| import net.bouzuya.bim.ConvertResult; | |
| import org.hamcrest.BaseMatcher; | |
| import org.hamcrest.Description; | |
| import org.hamcrest.Matcher; | |
| public class IsConvertResult extends BaseMatcher<ConvertResult> { | |
| private final ConvertResult expected; |
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
| %\usepackage{luatexja} | |
| \setmainfont{TakaoPMincho} | |
| \setsansfont{TakaoPGothic} | |
| \setmonofont{TakaoGothic} | |
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
| @Test | |
| public void iso8601() { | |
| assertThat(toIso8601(0), is("1970-01-01T00:00:00Z")); | |
| } | |
| private String toIso8601(long time) { | |
| DateTimeFormatter local = ISODateTimeFormat.dateTimeNoMillis(); | |
| DateTimeFormatter utc = local.withZoneUTC(); | |
| return utc.print(time); | |
| } |
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
| require 'rubygems' | |
| require 'bundler/setup' | |
| require 'aws-sdk' | |
| # NOTE: require ENV[...] | |
| # export AWS_ACCESS_KEY_ID='...' | |
| # export AWS_SECRET_ACCESS_KEY='...' | |
| # export AWS_REGION='ap-northeast-1' | |
| s3 = AWS::S3.new |
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
| # | |
| # Usage: | |
| # | |
| # export AMAZON_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' | |
| # export AMAZON_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
| # export BASE_DOMAIN='example.com' | |
| # export RECORD_VALUE='www.example.com' | |
| # | |
| # ruby route53_user_manager.rb add bouzuya | |
| # #=> bouzuya.example.com. CNAME www.example.com. |
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
| var fs = require('fs'); | |
| var crypto = require('crypto'); | |
| function hash(filename, callback) { | |
| var sha1 = crypto.createHash('sha1'); | |
| var s = fs.ReadStream(filename); | |
| s.on('data', function(data) { | |
| sha1.update(data); | |
| }); |
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
| var async = require('async'); | |
| async.map([1, 2, 3], function(item, next) { | |
| console.log(item); | |
| next(null, item * 2); | |
| }, function(err, results) { | |
| console.log(results); | |
| }); | |
| // 1 | |
| // 2 |
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
| console.log('#' + [1, 2, 3].map(function(item) { return item * 3; }).join(' #')); | |
| // #3 #6 #9 |
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
| // npm install twitter | |
| var twitter = require('twitter'); | |
| function newTwitterClient() { | |
| var consumerKey = process.env.TWITTER_CONSUMER_KEY; | |
| var consumerSecret = process.env.TWITTER_CONSUMER_SECRET; | |
| var accessTokenKey = process.env.TWITTER_ACCESS_TOKEN_KEY; | |
| var accessTokenSecret = process.env.TWITTER_ACCESS_TOKEN_SECRET; | |
| var params = { | |
| consumer_key: consumerKey, |