Skip to content

Instantly share code, notes, and snippets.

💭
😄

Kenichi Takahashi kenchan

💭
😄
View GitHub Profile
@kenchan
kenchan / output.txt
Created Feb 23, 2020
Ruby 2.3での階乗計算
View output.txt
Warming up --------------------------------------
** 70.304k i/100ms
my pow 27.298k i/100ms
Calculating -------------------------------------
** 1.633M (± 5.7%) i/s - 8.155M in 5.012777s
my pow 345.490k (± 3.6%) i/s - 1.747M in 5.063730s
Comparison:
**: 1632697.1 i/s
my pow: 345489.6 i/s - 4.73x slower
View bigdecimal.md
irb(main):013:0> require 'bigdecimal'
=> false
irb(main):014:0> 10.times.inject(0.0) {|i, _| i + 0.1 }.to_i
=> 0
irb(main):015:0> 10.times.inject(BigDecimal("0.0")) {|i, _| i + BigDecimal("0.1") }.to_i
=> 1
View feeds.yaml
- https://www.hsbt.org/diary/no_comments.rdf
- https://diary.shu-cream.net/atom.xml
- https://june29.jp/index.xml
View house.md
  • 下着 n 日分
  • 服 n 日分
  • パジャマ
  • バスタオル (ありそう)
  • タオル (ありそう)
  • ハブラシ
  • シェーバー
  • モバイルバッテリー
  • Apple Watch充電するやつ
  • 充電器
@kenchan
kenchan / inifity_benchmark.rb
Last active Nov 15, 2018
Float::INFINITYってrangeに使うとどうなんだっけ?
View inifity_benchmark.rb
require 'benchmark/ips'
Benchmark.ips do |x|
x.report("2..50") {
case rand(50)
when 1
1
when 2..50
50
else
View compare.rb
require 'benchmark/ips'
Benchmark.ips do |x|
x.report("if") do |i|
if i % 5 == 0
i
end
end
x.report("raise") do |i|
View gist:1dcbf0d903a2f253f3a2aac7478b3403
This file has been truncated, but you can view the full file.
{"traceEvents":[{"pid":32600,"tid":775,"ts":70463777507,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":46,"tdur":29,"tts":215572},
{"pid":32600,"tid":775,"ts":70463777573,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":7,"tdur":7,"tts":215622},
{"pid":32600,"tid":775,"ts":70463777689,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../mojo/public/cpp/system/simple_watcher.cc","src_func":"Notify"},"dur":736,"tdur":478,"tts":215693},
{"pid":32600,"tid":775,"ts":70463777730,"ph":"I","cat":"disabled-by-default-devtools.timeline","name":"TracingStartedInBrowser","args":{"data":{"frameTreeNodeId":2,"persistentIds":true,"frames":[{"frame":"0FCE1B6B539574D2372BB23B510937FC","url":"about:blank","name":"","processId":32603}]}},"tts":215733,"s":"t"},
View gist:0d96e660f8b3893bf0b17c1130d68925
This file has been truncated, but you can view the full file.
{"traceEvents":[{"pid":31994,"tid":775,"ts":70218051313,"ph":"X","cat":"toplevel","name":"ThreadControllerImpl::DoWork","args":{"src_file":"../../ipc/ipc_mojo_bootstrap.cc","src_func":"Accept"},"dur":476,"tdur":442,"tts":136252},
{"pid":31994,"tid":775,"ts":70218051677,"ph":"I","cat":"disabled-by-default-devtools.timeline","name":"TracingStartedInPage","args":{"data":{"sessionId":"1000031994.0","page":"1C6E2DD902D0DA7F3B4A143A026F549D","persistentIds":true,"frames":[{"frame":"1C6E2DD902D0DA7F3B4A143A026F549D","url":"about:blank","name":""}]}},"tts":136600,"s":"t"},
{"pid":31994,"tid":775,"ts":70218051802,"ph":"X","cat":"toplevel","name":"ThreadControllerImpl::DoWork","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":13,"tdur":13,"tts":136707},
{"pid":31994,"tid":775,"ts":70218051825,"ph":"X","cat":"toplevel","name":"ThreadControllerImpl::DoWork","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":11,"tdur":12,"tts":136730},
View yatteru.rb
require 'octokit'
require 'faraday-http-cache'
Octokit.auto_paginate = true
Octokit.middleware = Faraday::RackBuilder.new do |builder|
builder.use Faraday::HttpCache, serializer: Marshal, shared_cache: false
builder.use Octokit::Response::RaiseError
builder.adapter Faraday.default_adapter
end
You can’t perform that action at this time.