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
$ psql -U test_user test_db | |
test_db=> CREATE TABLE jojo ( id serial, chapter int, data json ); | |
INSERT INTO jojo VALUES (1, '{ "title": "ファントムブラッド", "character": { "hero": "ジョナサン・ジョースター" } }'); | |
INSERT INTO jojo VALUES (2, '{ "title": "戦闘潮流", "character": { "hero": "ジョセフ・ジョースター" } }'); | |
INSERT INTO jojo VALUES (3, '{ "title": "スターダストクルセイダース", "character": { "hero": "空条承太郎" } }'); |
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
<?php | |
# tmp.txtは `git cat-file -p <commit id>` の中身 | |
$contents = file_get_contents('tmp.txt'); | |
$obj = sprintf("commit %d\0%s", strlen($contents), $contents); | |
echo sha1($obj); |
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 'prime' | |
require 'date' | |
puts [*Date.new(2015, 1, 1).upto(Date.new(2015, 12, 31))].flat_map{|d| | |
Prime.prime?(d.strftime('%Y%m%d').to_i) ? [d.to_s] : [] | |
} |
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
// これを | |
$x = ['PHP', 'Ruby', 'Perl']; | |
// こうしたい | |
$x = ['PHP', 'Perl', 'Ruby']; |
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
$ go run mynumber.go | |
> true |
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
$ go run xml_parse.go | |
2015/11/03 17:05:18 | |
Microsoft、「OneDrive」の無料容量縮小ヘ “容量無制限”は終了 - ITmedia ニュース - 38user | |
http://www.itmedia.co.jp/news/articles/1511/03/news033.html | |
2015/11/03 14:06:00 | |
Microsoft、「OneDrive」のプラン内容の変更を発表 ー 無制限廃止や無料容量の縮小(15GB⇒5GB)など | 気になる、記になる… - 28user | |
http://taisy0.com/2015/11/03/60454.html |
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
for i in `say -v '?' | cut -f 1 -d ' '`; do echo $i;say -v $i ka e ri ta i ; done |
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
$i^($i>>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
def validate_my_number(mynumber) | |
# 整数列化 | |
digits = mynumber.to_s.chars.map(&:to_i) | |
# 12桁しか認めない | |
return false unless digits.length == 12 | |
# チェックデジットを分離します | |
check_digit = digits.pop | |
# 残った数字を小さい方から調べます | |
digits.reverse! |
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 app = Application.currentApplication(), | |
iTunes = Application('iTunes'); | |
app.includeStandardAdditions = true; | |
var allTracks = iTunes.playlists[0].tracks(); | |
var randomTrack = allTracks[Math.floor(Math.random() * allTracks.length)]; | |
app.displayNotification(randomTrack.artist(), { | |
withTitle: randomTrack.name(), |