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
#!/usr/bin/env bash | |
IFS=$'\n'; | |
for file in `ls ./iTerm2-Color-Schemes/Xresources`; do | |
cat "./iTerm2-Color-Schemes/Xresources/${file}" \ | |
| sed -e 's/^\!/#/g' -e 's/^\*\.//g' -e 's/: / = /g' \ | |
> "./termite-colors/${file}" | |
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
#!/usr/bin/env ruby | |
require 'time' | |
require 'json' | |
unless ARGV.length == 1 | |
puts "Usage: ruby kintai.rb [input file]" | |
exit 1 | |
end |
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
module SimpleBenchmark | |
require 'benchmark' | |
def benchmarker(report_name) | |
Benchmark.bm 10 do |r| | |
r.report(report_name) do | |
yield | |
end | |
end | |
end | |
end |
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 search(key, list) do | |
list | |
|> Enum.split(2) # convert list to key/value | |
|> Tuple.to_list | |
|> Enum.filter_map(fn(v) -> v |> List.first == key end, &(&1 |> List.last)) | |
|> List.first | |
end | |
search("hoge", ["hoge", 1, "fuga", 2, "piyo", "baz"]) # 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
# mix.exs | |
defp deps do | |
[{:timex, "~> 1.0.0-rc2"}] | |
end | |
# on your source | |
Timex.Time.now(:secs) |
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 search(key, list) do | |
list | |
|> Enum.split(2) # convert list to key/value | |
|> Tuple.to_list | |
|> Enum.filter_map(fn(v) -> v |> List.first == key end, &(&1 |> List.last)) | |
|> List.first | |
end | |
search("hoge", ["hoge", 1, "fuga", 2, "piyo", "baz"]) # 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
source = { | |
hoge: { piyo: { | |
piyo1: 'piyo1', | |
piyo2: 'piyo2' | |
}, baz: 'baz' }, | |
fuga: { foo: 'foo', bar: 'bar' } | |
} | |
fetch_hash = ->(source, key, separator='_') do | |
key.split(separator) | |
.reduce(source) { |msg, v| msg[v.to_sym] || {} } |
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
class Hoge | |
private | |
def fuga | |
'hoge' | |
end | |
end | |
module Piyo | |
def baz | |
fuga() |
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
# No.4 | |
list = [50, 2, 1, 9] | |
list.sort_by(&:to_s).reverse.join | |
# No.5 | |
[*2..9].reduce(['1']) do | |
|res, v| res.map { |r| ['', ' + ', ' - '].map { |oper| "#{r}#{oper}#{v}" } }.flatten | |
end.select { |v| eval(v) == 100 } |
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
# only run spec | |
box: nanapi/[email protected] | |
no-response-timeout: 10 | |
services: | |
- ibash/mysql5.6 | |
build: |
NewerOlder