自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 博客转移

以后不会在这里更新博客,博客地址转移到 [url]http://zhangzhe.heroku.com/[/url]。

2010-02-16 16:14:17 98

useful cheat sheets.

no need download cheat anymore:)in install:sudo gem install cheatuse:cheat <sheet name>see all:cheat sheetshelp:cheat cheat

2009-11-11 14:40:36 76

refactor according "rails best practices"

used "rails best practices" today. details see:http://github.com/flyerhzm/rails_best_practices  below are the refactor advices for my app :./config/routes.rb:58 - not use default route./...

2009-11-09 17:53:22 118

code refactor(keep adding)

1.old codedef page_group_toolbar(page_group) c = "" case page_group.class_name when "Preparation" c << li_link_to(t("Preparation"), admin_self_study_page_groups_path(:scenario_...

2009-11-05 10:20:08 125

define_method with parameters

refactor below code:  def preparation?(page_group) page_group.class_name == "preparation".camelize end def task_card?(page_group) page_group.class_name == "task_card".camelize...

2009-11-03 18:07:05 81

example how to use 'stub' and 'mock' in sepc

Use sometime to learn stub and mock.I think below is a good example: code: def create_from_content(content) page_content = PageContent.new(content) templet = page_content.temp...

2009-10-16 11:58:00 82

spec tips(keep adding)

1.stub meet "one to many" relationship Here is the code:describe "original_content" do it "should generate page_group's original_content" do page_group = PageGroup.create pag...

2009-10-13 17:20:58 113

原创 unbutu tips(keep adding)

apt:apt-cache search package 搜索包sudo apt-get install package 安装包sudo apt-get install package - - reinstall 重新安装包sudo apt-get remove package 删除包sudo apt-get update 更新源fuser:fuser ...

2009-09-21 15:39:00 171

do not rewrite exists methods

In order to name method like a pro, I create this stupid method in Page model: def to_xml(type = nil) case type when :flex # ... when nil super() endend So later when I...

2009-09-20 23:30:43 69

never use not + not.

A bug take a long time to find out.I had a method like:  def file_not_exsit_with?(url) require 'open-uri' return open(url).read =~ /^Status: 500 Internal Server Error/ rescue puts ...

2009-09-19 22:57:10 88

use screen

Doing long time rake, screen is a good assistant.  screen -S + name         start screen with name screen -r + name          resume a screenscreen -D + name        detach an attached scree...

2009-09-19 02:28:55 209

ruby trickes(keep adding)

some ruby tricke:   1.shorter regular expressionstring = "I am strong..."puts string[/(.*?)(\.+)/, 1]   # => I am strong 2.add methods to classclass String def test1 "tes...

2009-09-08 12:28:08 129

how to test gem

I wrote some gems in my project, but testing them is a big pain.Everytime I want to make sure all functions work, I need to make a test model outside gem and test there. Here is one solution:m...

2009-08-31 14:09:54 110

原创 things learned from data migration

Spend a week for data migration.  Here are some things I learned:1. class OldScenario < ActiveRecord::Base establish_connection configurations['old_db'] set_table_...

2009-08-20 13:57:32 88

我的emacs配置

学习ruby on rails 两年了,期间使用过Eclipse和Netbeans,半年以前开始使用emacs。经过刚开始的不适,半年来不断到处拷代码,改配置。最近感觉逐渐使得顺手了。把配置贴出来做一个记录,也希望能对其他人有启发或者帮助 :) model:[img]http://zzhang.iteye.com/upload/attachment/131957/3cab88d...

2009-08-03 15:45:05 76

诡异的"already initialized constant OPTIONS"及解决方案

最近要为公司一个程序加数据统计代码。在Ubuntu环境下checkout下整个程序,发现无法打开server,出错信息如下:=> Booting Mongrel (use 'script/server webrick' to force WEBrick)=> Rails application starting on http://0.0.0.0:3000=> Call with ...

2007-10-15 12:40:25 1596

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除