Skip to content

Instantly share code, notes, and snippets.

View gist:218732
Feature: Items in scheduled
As an singed up user
I want to manage my todos or projects which placed in scheduled
Given I am a confirmed user and signed in as "" with password "iamtom"
Scenario: Move a new todo to Scheduled
When I create a todo "To meet David" on "" about "About trip planning"
And I drag todo "To meet David" to place Scheduled
View gist:219642
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"
View gist:227983
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"
View gist:227990
# Cucumber helper for multiple forms in one page by RainChen @ 2009-11-06
# more detail:
# 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:
View i18n.rb
# Rails i18n helpers by RainChen @ 2009-11-09
# more detail:
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'
View gem list
*** 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)
View gist:234591
class1 = function() {
// private fields
var m_first = 1;
var m_second = 2;
// public attributes
this.p_3 = 3;
// private methods
function constructor() {;
View gist:236757
// jquery ajax helper by RainChen @ 2009-11-4
// more detail:
// show the ajax result
app.ajax.showResult = function(options){
options = $.extend({title: '', body: '', width: 350, height: 200, iframe: false, zIndex: 7000}, options);
$(document.body).append('<div id="app_ajax_result"></div>');
title: '',
View debug.rb
# debugging helper for cucumber by RainChen @ 2009-11-18
# more detail:
if Cucumber::VERSION == '0.4.4'
Then /^(.+) for debugging$/ do |whatever|
ENV['DEBUGGING'] = whatever
warn(%{Debuging: Then #{whatever}})
Then %{#{whatever}}
View gist:350424
// 豆瓣:高亮楼主
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")}});})();