- go version go1.13.3 darwin/amd64
$ pip install awscli
$ pip install aws-sam-cli
curl https://kenzo0107.hatenablog.com/rss -o hatena-rss.xml | |
sudo gem install jekyll-import | |
ruby -e 'require "jekyll-import"; | |
JekyllImport::Importers::RSS.run({ | |
"source" => "hatena-rss.xml" | |
})' |
name: static check | |
on: push | |
jobs: | |
imports: | |
name: Imports | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: check |
name: Test | |
on: [push] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.13.x] | |
platform: [macos-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: |
FROM ruby:2.6-alpine as base | |
ENV RAILS_ENV production | |
# Update rubygems | |
RUN gem update --system | |
RUN gem update bundler --pre | |
RUN bundle config set without development:test | |
# == builder |
def div_hash_each(r) | |
h = {} | |
p = [10_000, 5_000, 2_000, 1_000, 500, 100, 50, 10, 5, 1] | |
p.each_with_index{|d, index| | |
a, r = r.divmod(d) | |
h[d] = a | |
} | |
return h | |
end |
def div_hash_inject(r) | |
[10_000, 5_000, 2_000, 1_000, 500, 100, 50, 10, 5, 1].inject(Hash.new(0)){|h, d| | |
a, r = r.divmod(d) | |
h[d] = a | |
h | |
} | |
end | |
p div_hash_inject(123_456) # {10000=>12, 5000=>0, 2000=>1, 1000=>1, 500=>0, 100=>4, 50=>1, 10=>0, 5=>1, 1=>1} |
def div_each(r) | |
b = [] | |
p = [10_000, 5_000, 2_000, 1_000, 500, 100, 50, 10, 5, 1] | |
p.each_with_index{|d, index| | |
a, r = r.divmod(d) | |
b << a | |
b << r if p.size - 1 == index | |
} | |
return b | |
end |
def div_inject(r) | |
[10_000, 5_000, 2_000, 1_000, 500, 100, 50, 10, 5, 1].inject(r){|(*a, r), d| | |
a + r.divmod(d) | |
} | |
end | |
p div_inject(123_456) # [12, 0, 1, 1, 0, 4, 1, 0, 1, 1, 0] |
package utility | |
const ( | |
defaultLength = 0 | |
defaultCapacity = 64 | |
) | |
// Configs ... elements of a slice | |
type Configs struct { | |
Length int |