Skip to content

Instantly share code, notes, and snippets.

View eiel's full-sized avatar

HIMURA Tomohiko eiel

View GitHub Profile
@eiel
eiel / file0.rb
Last active August 29, 2015 14:12
特定のマイルストーンのIssueの一覧を取得する ref: http://qiita.com/eielh/items/6890b18974180deb5c61
require 'octokit'
def issues_filter_milestone(repo, name)
number = Octokit.list_milestones(repo).select do |milestone|
milestone.title == name
end.first.number
Octokit.list_issues(repo, milestone: number)
end
issues_filter_milestone("great-h/great-h.github.io","20141224")
@eiel
eiel / json_print.rb
Created January 24, 2015 04:43
json print
require 'json'
def jp(json_value,places = [])
case json_value
when Hash
json_value.each do |key,value|
jp(value,places.dup.push(key))
end
when Array
json_value.each_with_index do |value,index|
@eiel
eiel / circleci_env_to_docker_option.rb
Created February 10, 2015 07:01
CircleCIでdockerへの環境変数を渡すためのオプション生成をするスクリプト。
def env_format(key,value)
"-e #{key}=#{value}"
end
envs = $stdin.readlines
.map { |line|
if match = line.match(/^ ([^=]*).*/)
env = match[1]
[env,"$#{env}"]
end
@eiel
eiel / parkmap.geojson
Last active August 29, 2015 14:15
ちょっと試しにGeoJSONつくってみた。
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eiel
eiel / ppm2colors.rb
Created March 4, 2015 14:41
P3なPPM形式の画像の各色の数を数える。
ppmtype = ARGF.readline.chop
width, height = *(ARGF.readline.chop.split)
max = ARGF.readline
hash = Hash.new(0)
ARGF.read.split.map(&:to_i).each_slice(3) do |color|
hash[color] += 1
end
hash.each do |k,v|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.