Skip to content

Instantly share code, notes, and snippets.

View giruzou's full-sized avatar

DrqYuto(みなと giruzou

View GitHub Profile
@giruzou
giruzou / songle-sync-master.html
Created June 24, 2019 13:42
Songle Sync Tutorial Step.3 (songle-sync-master.html)
<html><head><script src="//api.songle.jp/v2/api.js"></script><script>
function onSongleWidgetAPIReady(SongleWidget) {
// 音楽プレーヤーを表示する
var player = new SongleWidget.Player({
accessToken: '00000090-KtkWYyy' // アクセストークン
, secretToken: '2ixLaohRmaKrjS1qSHhfcMeVR27UTg8C' // シークレットトークン
});
player.useMedia(
'https://youtube.com/watch?v=xOKplMgHxxA',
puts readlines.map(&:to_i).sum
@giruzou
giruzou / ruby
Created December 15, 2018 10:32
Ruby10進数を2進数に変化 ref: https://qiita.com/DrqYuto/items/0a6faa029e9359c7cc4d
puts gets.to_i.to_s(2)
=begin
7
111
=end
@giruzou
giruzou / file0.txt
Last active December 14, 2018 10:22
2*2行列を数値として処理するRuby ref: https://qiita.com/DrqYuto/items/57421b1bf4c2dc3e6c4f
x = readlines.map{|line| line.chomp.split(/\s/).map(&:to_i)}
puts x.map{|row| row.map{|i| i+1} }.map{|row| row.join(" ")}.join("\n")
=begin
1 1
1 1
2 2
2 2
=end
@giruzou
giruzou / file0.txt
Created November 30, 2018 08:54
HerokuにデプロイしたRoRをターミナルで更新するコード4行 ref: https://qiita.com/DrqYuto/items/795608263fdabcdb4bb3
$git add -A
$git commit -m "Update application"
$git push heroku master
$heroku run rails db:migrate
@giruzou
giruzou / file0.txt
Last active November 24, 2018 12:45
競プロでよく使うUFO ref: https://qiita.com/DrqYuto/items/3390840856e8a291c4f5
case (foo <=> bar) <=> 0
when 0
#等しい時
when 1
# fooのほうが大きい時
else
# fooのほうが小さい時
end
@giruzou
giruzou / ruby
Last active November 5, 2018 07:13
Ruby最大値(max)と最小値(min)の位置インデックス(index)を得る方法 ref: https://qiita.com/DrqYuto/items/4d4f0147659803e38d55
a=[1,2].each_with_index.max[1]+1
#=>2
a=[1,2].each_with_index.min[1]+1
=>1
@giruzou
giruzou / ruby
Created October 20, 2018 08:34
Rubyアルファベット文字数 ref: https://qiita.com/DrqYuto/items/d2321d0fbaaeaa5b03c8
puts [*?a..?z].size
=>26
require 'complex'
p Math.sqrt(2)
#=>1.4142135623730951
@giruzou
giruzou / ruby
Created October 17, 2018 09:26
Ruby二列からの入力4種 ref: https://qiita.com/DrqYuto/items/739fce679360eb14b257
n,T=gets.split.map &:to_i;