mysql,Linux,HighPerformance,ruby on Rails

2010年8月11日星期三

读gem sourcecode or doc的工具

阅读别人的代码,估计是最好的学习方式了。但遥想之前,不管是java获得C++,要求阅读者具备的积累都不是"一天"就能搞定的。
Ruby语法简单,有点不优雅,但让我能快速学习上手。
tip:
gem install open_gem

安装此插件后,
gem open rails 就可以读原码。
gem read rails 就可以看文档。

当然操作系统也要提个好的,fedora是我的推荐。


--
tommy xiao
E-mail: xiaods(AT)gmail.com

2010年8月9日星期一

git pull config question

I think this very useful for git user, just notice this url

Under [branch "master"], try adding:

[branch "master"]
    remote
= origin
    merge
= refs/heads/master

This tells Git 2 things:

  1. When you're on the master branch, the default remote is origin.
  2. When using git pull on the master branch, with no remote and branch specified, use the default remote (origin) and merge in the changes from the master branch.


ref:
http://stackoverflow.com/questions/658885/how-do-you-get-git-to-always-pull-from-a-specific-branch

WEB基本功,HTML优化

今天看了一篇文章,HTML优化,很实用。
http://perfectionkills.com/optimizing-html/
中文版也不缺乏:
http://younglab.blog.51cto.com/416652/294670

--
tommy xiao
E-mail: xiaods(AT)gmail.com

2010年8月3日星期二

Rails3使用jquery rjs,可能需要注意的地方。mark

这里假设你使用rails3, jquery rails.js

你想实现ajax loading效果,却发现rails的tag里只使用:remote => true
并没有rails2里使用的loading函数。
我看了rails.js,看到

The UJS drivers trigger six events on every AJAX call:

  • ajax:before
  • ajax:loading
  • ajax:success
  • ajax:failure
  • ajax:complete
  • ajax:after
但是怎么使用是个问题。
看了这个ticket,就知道并不是所有人了解:
https://rails.lighthouseapp.com/projects/8994/tickets/4486-new-ujs-helpers-do-not-have-a-way-to-render-a-loading-text-icon
his can easily be accomplished each driver has a custom callback that fires before the request is sent, here is an example using the jQuery driver.
  $('#new_resource').live('ajax:loading', function() {
// code to display loading div
});


refs:
https://rails.lighthouseapp.com/projects/8994/tickets/4486-new-ujs-helpers-do-not-have-a-way-to-render-a-loading-text-icon
http://www.slideshare.net/adamlogic/jquery-and-rails-sitting-in-a-tree
http://code.alexreisner.com/articles/link-to-remote-with-ujs.html