RSSリーダを使いやすくするためのTips

Railsのログに関する覚書き

v 2.3.5で確認。

ログの出力方法をいろいろ設定したい

config/environment.rbに記述

# ANSI制御シーケンスをログに出力しない
config.active_record.colorize_logging = false

# ログの出力先を変更
config.log_path=/var/log/appl.log

# ログファイルのローテート
config.logger = Logger.new(config.log_path, 'daily') # 日別
config.logger = Logger.new(config.log_path, 10, 1024 * 1024) # サイズ

ちなみにenvironment.rbでは、ActiveSupportはまだ未ロードなので1.megabytesとかは使えない。

script/consoleで発行されるSQLを確認したい

ActiveRecord::Base.logger = Logger.new(STDOUT)

このコマンドを入力する前にSQLを流してしまうと、Loggerインスタンスが生成されてしまうので
起動直後にやること。

config/initializers/xxx.rbに記述しておくと自動で読み込んでくれる。
でもmigrationの時とかウザイので注意。

自分でロガーを作って別ファイルにログを出力したい

logger ||= ActiveSupport::BufferedLogger.new(File.join(Rails.root, 'log', 'batch.log'))
logger.debug("test message")

ログの出力フォーマットに時間とレベルを出力したい

config/initializers/log_format.rbを追加

ActiveSupport::BufferedLogger.class_eval do
 SEVERITIES = self::Severity.constants.inject({}){ |val, con| val[eval("self::#{con}")] = con; val }
 def add_with_format(severity, message = nil, progname = nil, &block)
   add_without_format(severity, nil) { "%s [%5s] %s" % [Time.now.strftime("%Y/%m/%d %H:%M:%S"), SEVERITIES[severity], message] }
 end
 alias_method_chain :add, :format
end

モンキーパッチをあてる。

Chromium(Ubuntu)で今使ってるChromeExtentions(2010/02版)

FirefoxからGoogleChromeへ移行するのを後押しした10のエクステンションと少しのTips

><
まず自分のブラウジングについて少し。


メインPCはUbuntu/Firefoxで主にGoogleReaderを見てdelicious/Tumblr/Instapaperを外部記憶に使ってる。


はてブとか2ch,ニコニコなどはあまり見ない。普通のブラウジングを高速、快適にしたいという前提だと思いねえ。



AutoPagerize for Chrome


いわずとしれたAutopagerize。もうこの機能がないブラウザは使う気がしない。


これがあったらChromeに移行したといってもいいエクステンション。



Chrome Gestures


マウスジェスチャ。デフォルト設定に加えて↑にScroll to Top、↓にScroll to Bottomを割り当てている。


ちなみにChromiumではうまく動いていない。


スムーススクロールまでついて至れり尽くせり。


Xmarks Bookmark Sync


Chrome自体にGoogleBookmarkを利用したBookmark Sync機能があるけど、Firefoxからの移行組としてはやはりFirefoxとブックマークを連携したいと思う。


Docs PDF/PowerPoint Viewer


ページ上のPDFファイルのリンクをGoogleDocsで開くように置き換えてくれるエクステンション。


以前はbookmarkletを使ってたけど自動で置き換えてくれて便利。


RSS Subscription Extension


RSSがあるサイトでは、Firefoxと同様にURLバーにRSSアイコンを表示してくれる。


アイコンをクリックしてRSSリーダに登録できる。


Go Up


URLバーにアイコンが表示されて、クリックすると一つ上のディレクトリに移動するだけのエクステンション。


地味に便利。


Taberareloo


TomblooChrome版。


対応サイトは

となっている。DeliciosとTumblr、Instapaperがあれば、自分的にはまったく問題無し。


もちろんタグの自動提示もしてくれる。


Context Search


ページ上の文字列を選択するとプルダウンメニューがでて、そこで選択したサイトで検索できる。


オレは以下のサイトを登録してる。このURLはURLバーからの検索サイトにも登録できるので便利。

Google
http://www.google.co.jp/search?q=%s
Wikipedia(ja)
http://ja.wikipedia.org/w/index.php?search=%s
英辞郎
http://eow.alc.co.jp/%s/UTF-8/
GoogleMaps
http://maps.google.co.jp/maps?q=%s
Amazon
http://www.amazon.co.jp/gp/search?field-keywords=%s&index=blended&__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A

Bubble Translate


選択した部分だけを翻訳してポップアップ表示と、ページ全体をGoogleranslateで翻訳してくれる。


英語の他にドイツ、オランダ、スペイン語なども翻訳できる。


ChromeStylist


サイトに自分で指定したスタイルシートを適用できる。FirefoxでいうStylishやUserStyles.orgのようなもの。


いろいろ書けばAdBlock+的なことができると思う。


やっぱりFirefoxで使ってたやつを少しカスタマイズして使ってる。いくつか紹介しておく。



Google Reader Absolutely Compact


GoogleReaderの表示領域を最大限まで広げてくれる。

/* Hide all the elements that take up space */ #logo-container, #gbar, #global-info, .gbh, #lhn-add-subscription-section, #viewer-footer, #chrome-view-links, #mark-all-as-read, #viewer-refresh, #viewer-details-toggle, #chrome-lhn-toggle, .scroll-tree .icon, .entry .entry-title .entry-title-go-to, #entries.list .collapsed .entry-main .entry-original { display: none !important; } /* move the main window up to the top to fill in leftover space */ #main, #settings-frame, #settings { top:0 !important; margin: 0 !important; } /* tighten up the vertical padding on header bars */ #viewer-top-controls, #chrome-header { padding: 2px 0 2px 5px !important; } /* right-justify the \"Loading...\" and other messages so they don't obscure other elements */ #loading-area, #message-area-outer { width: auto !important; left: auto !important; right: 0 !important; top: 26px !important; } /* right-align search bar and hide buttons until hovering */ #search { left: auto !important; right: 10px !important; top: 1px !important; width: 210px !important; height:23px !important; overflow: hidden !important; } #search:hover { width: 403px !important; height:323px !important; overflow: visible !important; } #search-restrict-button .goog-menu { left: auto !important; right: 0 !important; } #chrome.search-stream #viewer-search-parent { text-align: left !important; } /* shrink the navigation sidebar */ #nav, #nav * { max-width: 175px !important; } #chrome { margin-left: 175px !important; } .lhn-hidden #chrome { margin-left: 1px !important; } #entries .entry-body { max-width: none !important; } /* remove icons from navbar and tighten the left margin for folder/subscription entries */ .scroll-tree .expanded .toggle { background-position: 3px -58px !important; } .scroll-tree .collapsed .toggle { background-position: -20px -58px !important; } #lhn-subscriptions .scroll-tree li a { padding-left: 0 !important; } #lhn-subscriptions #sub-tree ul ul li a { padding-left: 10px !important; } #lhn-subscriptions .scroll-tree .toggle { width: 16px !important; } /* shrink titles, but add underlining for visual identification */ .entry .entry-title { font-size:100% !important; } .entry .entry-title .entry-title-link { text-decoration: underline !important; } /* tighten up spacing around entries */ /* expanded view */ #entries .entry { padding: 1px !important; margin: 0 !important; } #entries .card-content { padding: 2px !important; } #entries .card-common { padding: 0 !important; margin: 0 !important; border-width: 2px !important; } #entries .collapsed { padding: 0px !important; border: 0 !important; } /* list view */ #entries .collapsed .entry-date { margin: 0 2px 0 0 !important; } #entries #current-entry .collapsed { background-color: #C9DCFF !important; } #entries.list .collapsed .entry-icons, #entries.list .collapsed .entry-main .entry-original { top: 1px !important; } #entries.list .collapsed .entry-secondary { top: 0px !important; margin-right: 7em !important; } #entries.list .collapsed .entry-source-title { top: 0px !important; } #entries.list .collapsed .entry-title { text-decoration: none !important; } /* make entries borders square for consistency with new design */ .entry .card, .card .card-bottom { -moz-border-radius: 0 !important; }

GoogleMapsの表示領域を最大化してくれる。どこで拾ったのか忘れてしまった。。

  div#logo{
    display:none !important;
  }

  form#q_form .example{
    display:none !important;
  }

  form#q_form div.srchcol.controls{
    padding:0 0 0 10px !important;
  }

  span#solink a#showss{
    display:none !important;
  }

  #gbar{
    display:none !important;
  }

  #guser{
    float:right;
    font-size:90%!important;
  }

  .gbh{
    display:none !important;
  }

  #header{
    clear:none !important;
    width:400px !important;
  }

  div#gaia{
    float:right!important;
    clear:none !important;
    width:auto;
  }

  div#page{
    clear:both;
  }

  input#q_d{
    width:260px !important;
  }

  div#mclip{
    display:none !important;
  }

  /* ad */
  #pp-ads-container{
    display:none !important;
  }
}

GMailの広告やチャット領域を消す。

.nH.s, .nH.pY {
   display: none !important;
}

.iY .Bu:last-child > .nH {
	height: 0px !important;
	overflow: hidden !important;
	width: 0px !important;
}

.iY .Bu:first-child + .Bu {
	display: none !important;
}

.iY {
	width: 100% !important;
}

Yahoo!の広告領域を消す

div.yschspns, div.ynbox_side, div#yschiy, div#yschec, div#adLrec, div#pos-lrec, div#brandpanel {
  display: none !important;
}


あとはChrome Extentions by os0xASCII.jp:Chromeで使えるエクステンション厳選25本!とりあえず今すぐ使えるChromeエクステンション、11種類ご紹介と、
本家のGoogle Chrome Extensionsを参考にエクステンションを探してみるといいよ。

Girl2Uメンテしました

仕事も忙しいというのに、しばらくほったらかしだったのでGirl2Uをメンテナンスした。

  • 画像表示の高速化!
  • atomが正常に出力されてなかったのを直した。
  • permalinkによるアクセスができるようになった。
  • 画像サイズを320x480(iPhone壁紙サイズ)にした。(次回サムネイルから適用)


自分的に懸念だった画像表示が早くなったのがうれしい。これでみんな幸せになればいいのに!

次はiPhone対応かなあ。リクエストあればtwitterまで。


まぁ、あといろいろやったんだけど、いいや眠いし。。。。

まとめのまとめサイト作った

最近話題の画像ブログからなんか女の子と思われる画像をまとめるサイト作ってみました。
2chまとめbetaの後追いですね。すんません。


Girl2U

特徴
  • 話題の画像まとめサイトの動向をまとめて表示
  • さらに厳選された画像(前エントリ参照)を収集、一覧表示
  • sinatra+sequelサイコー。
そのうちやる(かも)

セマンティックが止まらない

2chまとめサイトにある画像をtwittertumblrフォト蔵にアップしたりする何かを書いた。

いくつかの大手2chまとめサイトを巡回して、画像や写真と思わしきものを見つけたらTwitterでつぶやきつつダウンロードする。
その画像を1時間おきに数枚ランダムにTumblrにポストして、厳選された画像はまとめてフォト蔵にバックアップする。

あれ?文字にするとこれだけ?なんかもっとうまく説明できるといいんだけどまぁいいや。
他人のふんどしで相撲をとってる感がものすごくするけど、まぁこれがセマンティックWebってことで(違)

みなさん友達になってやってくだちい。