代々木で働く超新米エンジニアの足跡

代々木で働くエンジニアです。超新米です。

2016-08-03から1日間の記事一覧

tweet api 取得数を指定してつぶやき取得

twitter api つぶやき数を指定して取得 title = @twitter.search("検索ワード") title.take(500).each do |tw| #以下略 参考:Twitter gemでツイート検索する場合の要点、及び:since_id指定を有効にするモンキーパッチ - Qiita

git branchの名前を変更

branchの名前を変える git branch -m <古いブランチ名> <新しいブランチ名>

twitter api リツイートを含む検索

RTを含むAPIでの検索 @twitter_client = Twitter::REST::Client.new do |config| config.consumer_key = "xxxx" config.consumer_secret = "xxxx" config.access_token = "xxxx" config.access_token_secret = "xxxx" end @twitter_client.search("検索ワード…

flatten

flatten 多次元配列をシンプルな配列にする array = [1, 2, 3, [4, 5]] p array.flatten #=>[1,2,3,4,5] 参考:flatten, flatten! (Array) - Rubyリファレンス

combination

combination 配列から引数n個の要素を選んだときの組合せを出力 array = ["a","b","c","d","e"] p array.combination(2).to_aa~eまでの、5C2の全てのパターンを出力