posted on March 30, 2010

在rails中不同的view不同皮肤下的js,css,注入js和css到head区域

利用layout可以很好实现这个需求.

在ApplicationHelper内加入如下代码:

def require_js(path)
    content_for :header_js do
      include_js_tag path
    end
  end

  def require_css(path)
    content_for :header_css do
      include_css_tag path
    end
  end

  def include_js_tag(path)
    if not path.starts_with?("http:")
      path = "/themes/#{@setting[:theme]}/javascripts/" + path
    end
    javascript_include_tag path
  end

   def include_css_tag(path)
    if not path.starts_with?("http:")
      path = "/themes/#{@setting[:theme]}/stylesheets/" + path
    end
    stylesheet_link_tag path
  end

(如果你要直接在view或者layout内引入css则可以<%= include_css_tag "global.css" %>,这样生成的路径是带有皮肤目录的)

接下来,修改你的layout的head,加入如下代码:

阅读剩余部分...

posted on March 3, 2010

请珍爱自己的身体

see see:

http://www.cnblogs.com/yiway/archive/2010/02/23/1672173.html

posted on February 9, 2010

关于女人这个神奇的东西,从网上找了些觉得同感的片片

女人总是把原本不属于自己的东西死死地认定为是自己的,然后患得患失; 更好玩的是,明明是自己不懂珍惜刁蛮成性而导致失去的东西,她们非要说成是别人的背叛,这点让男人挺没辙的。

阅读剩余部分...

posted on January 21, 2010

优化Rails数据库查询性能 -- rails_reviewer插件

发现一个很棒的插件 rails_reviewer插件

安装:

$ script/plugin install git://github.com/dsboulder/query_reviewer.git
$ rake query_reviewer:setup

完毕后重启server,页面左上角浮动一个SQL CRITICAL浮动窗口,里面记录页面加载时执行的所有SQL以及优化建议等。

强烈推荐 !!!

posted on January 21, 2010

使用window.location跳转,在IE中UrlReffer不被记录

使用window.location跳转,在FF中,没问题,下一页面可以取得UrlReffer,但在IE中UrlReffer不被记录

真变态,

让我头痛了半天,弄了个丑陋的办法做了如下实现:

阅读剩余部分...

posted on January 15, 2010

rails里Mysql::Error: query: not connected

从ubuntu换回了win7后又慢慢开始折腾以前在本本上跑的一些LAMP网站, php和 mysql还是用以前的xampp里的,仍然可以用。

重装了 ruby 1.8.6, rails 2.3.5 等...发现运行rails网站,弹出messagebox提示找不到libmysql.dll尝试把mysql/bin里的dll来regsvr32,不可,直接拷贝到system32目录下错误没了,但打开网站仍然报错,终端显示“Mysql::Error: query: not connected...."

阅读剩余部分...

posted on January 14, 2010

把typecho升级到0.7了

什么时候typecho能够像wp那样在线升级就好了。

posted on January 11, 2010

漂亮的VIM配色方案

这里
http://code.google.com/p/vimcolorschemetest/
有一堆一堆的配色方案

Browse By File Type

Featuring 428 schemes: