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("検索ワード include:retweets")
flatten
flatten
多次元配列をシンプルな配列にする
array = [1, 2, 3, [4, 5]] p array.flatten #=>[1,2,3,4,5]
combination
combination
配列から引数n個の要素を選んだときの組合せを出力
array = ["a","b","c","d","e"] p array.combination(2).to_a
a~eまでの、5C2の全てのパターンを出力
カラム名にhashは使えない Activerecord
カラム名に”hash”というワードは使えない
hash_dateとかなら大丈夫
参考:"hash is defined by Active Record" って怒られた - kakakakakku blog