Skip to content

Instantly share code, notes, and snippets.

//豆瓣:只显示楼主
javascript:void(function(){$(".topic-reply li").each(function(){ if($(this).find(".user-face a").attr('href')!=$(".user-face:first").find('a').attr('href')){$(this).toggle() } });})();
// 豆瓣:高亮楼主
javascript:void(function(){$(".topic-reply li").each(function(){ if($(this).find(".user-face a").attr('href')==$(".user-face:first").find('a').attr('href')) {$(this).css('border', "1px solid")}});})();
# debugging helper for cucumber by RainChen @ 2009-11-18
# more detail: http://hi.baidu.com/rainchen/blog/item/ee410708d2f5a63ae8248823.html
if Cucumber::VERSION == '0.4.4'
Then /^(.+) for debugging$/ do |whatever|
ENV['DEBUGGING'] = whatever
warn(%{Debuging: Then #{whatever}})
Then %{#{whatever}}
end
// jquery ajax helper by RainChen @ 2009-11-4
// more detail: http://hi.baidu.com/rainchen/blog/item/8877861821904abe4bedbc07.html
// show the ajax result
app.ajax.showResult = function(options){
options = $.extend({title: '', body: '', width: 350, height: 200, iframe: false, zIndex: 7000}, options);
if(!$("#app_ajax_result").get(0)){
$(document.body).append('<div id="app_ajax_result"></div>');
$("#app_ajax_result").dialog({
title: '',
class1 = function() {
// private fields
var m_first = 1;
var m_second = 2;
// public attributes
this.p_3 = 3;
// private methods
function constructor() {
console.info(this.p_3);
*** LOCAL GEMS ***
actionmailer (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
actionpack (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
activerecord (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
activeresource (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
activesupport (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
acts_as_paranoid (0.3.1)
# Rails i18n helpers by RainChen @ 2009-11-09
# more detail: http://hi.baidu.com/rainchen/blog/item/b393fc03589f4b82d53f7c37.html
class String
# short curt for I18n.t
# This returns the translation for foo or default if no translation was found:
# "foo".t # => "foo"
# "hello".t "en" # => "hello"
# "hello".t :default => 'halo'
# Cucumber helper for multiple forms in one page by RainChen @ 2009-11-06
# more detail: http://hi.baidu.com/rainchen/blog/item/dfad7931f77e2413ebc4afc1.html
# select a form as current scope
When /^I focus on the form which "([^\"]*)" is "([^\"]*)"$/ do |attr, value|
selector = "form[@#{attr}='#{value}']"
# within using: Webrat::XML.css_at(@scope.dom, @selector)
# p webrat_session.within("form[@action='/pages/search']") {|scope| scope.dom }
# xpath_search requried ".//" , for example:
Scenario: Searching pages
Given I create a sub page "About us" for "/"
And I create a sub page "Contact us" for "About us"
When I go to "/pages/admin"
Then I should see "Search pages"
When I focus on the form which "action" is "/pages/search"
And I select "title" from "scope"
And I fill in "query" with "us"
And I press "search"
Then I should see "About us"
Scenario: Move a project which have some todos to Scheduled
Given I create a project "Project A"
And I create todos "Todo A"
When I drag todo "Todo A" to project "Project A"
Then the todo "Todo A" should be placed in "Next"
When I drag project "Project A" to place Scheduled
Then I should see "Schedule"
When I fill in "Scheduled at" with the date "tomorrow"
And I fill in "Scheduled Action" with "move_to_today"
And I press "OK"