2009-09-16 [長年日記]
_ notify_miniblog.rbにtwitter用hashtagを付加するよう改造
以下のように修正しました。
$svn diff Index: notify_miniblog.rb =================================================================== --- notify_miniblog.rb (revision 35391) +++ notify_miniblog.rb (working copy) @@ -46,6 +46,7 @@ date = @date.strftime('%Y%m%d') diary = @diaries[date] sectitle = '' + hashtag = '' index = 0 diary.each_section do |sec| @@ -59,8 +60,9 @@ prefix = @conf['miniblog.notify.prefix'] format = @conf['miniblog.notify.format'] source = 'tdiary/notify_miniblog.rb' + hashtag = @hashtag.nil? ? '' : "#" - status = 'status=' + format % [prefix, sectitle, url] + '&source=' + source + status = 'status=' + format % [prefix, sectitle, url, hashtag] + '&source=' + source if @conf['miniblog.service'] == "HatenaHaiku" then status += '&keyword=id:' + @conf['miniblog.user'] end @@ -77,12 +79,13 @@ def notify_miniblog_init @conf['miniblog.notify.prefix'] ||= '[blog update]' - @conf['miniblog.notify.format'] ||= '%s %s %s' + @conf['miniblog.notify.format'] ||= '%s %s %s %s' @conf['miniblog.service'] ||= 'Twitter' end add_update_proc do if @mode == 'append' then + @hashtag = @cgi.params['miniblog.twitter.hashtag'][0] unless @cgi.params['miniblog.twitter.hashtag'][0].nil? notify_miniblog if @cgi.params['miniblog.notify'][0] == 'true' end end @@ -97,6 +100,9 @@ <input type="checkbox" id="miniblog.notify" name="miniblog.notify" value="true" tabindex="400"> Post the update to </label> + <label> + <input name="miniblog.twitter.hashtag" value="" tabindex="401">HashTag for Twitter + </label> </div> HTML end
追記
うまくいきました。あとはtwitter固有にしなくても、最後に好きな書式で文字列を埋め込めるようにしてみよう。眠いのでまた明日・・
_ 長男におもちゃを片付けさせたい - (2)
昨日の作戦決行結果は、無残な物でございました。夜9時近くになると眠いのか、
パパ、線路かたづけるよー
やーーーーーーーーだーーーーーーーーーーーーーーー
ココに片付けるね。一緒にやろー
やーーーーーーーーだーーーーーーーーーーーーーーー やーーーーーーーーだーーーーーーーーーーーーーーー
その後ふてくされて投げようとしたり、ぐちゃぐちゃにしようとしたり、諫めているといじけて泣き出してしまいました。
気長に気長に( ・ ∀ ・ )
_ スコア表示プラグインを作ろうか・・・
以下のスコア、試合結果を表示してくれるプラグインを考えています。
- ボーリング
- スコア計算もやらないと
- 引数が増える
- 点数を競う競技
- 野球
- 回も表示すると大変 => 引数が増える
- サッカー
- 野球
- セット数を競う競技
- バドミントン
- バレー
- テニスもそのままかな
ボーリングのスコア計算は
ちょうどよいRubyのお勉強題材かと思いました。いかん、仕事さぼって書きたくなってくる(((( ;゜Д゜)))
_ きょうのつぶやき : 60回
[ツッコミを入れる]