Skip to content

Instantly share code, notes, and snippets.

View lovesmall's full-sized avatar

Yiheng lovesmall

View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@barelyknown
barelyknown / unobtrusive_poller.js.coffee
Last active April 25, 2019 21:01
Unobtrusive JavaScript solution for polling in a Rails application
###
Unobtrusive JavaScript solution for polling in a Rails application
Introduction:
Add a polling-placeholder wrapper div to any partial and add a data attribute
named poll that should be equal to "true" until you want to stop polling.
The default polling frequency will be used unless you provide an "interval" data
attribute which should be the number of milliseconds to use for the interval.
@85636682
85636682 / gist:b16913953b204aa249fa
Last active November 14, 2018 03:02
安装Postgresql+Postgis
如果系统是ubuntu12,系统默认自带Postgresql9.1,首先我们把它删除了!
步骤:
1、列出关于postgre9.1的包
dpkg -l | grep postgres
如果是9.1,下面列表的8.3就是9.1,有一些包可能没有,是系统而定。
ii postgresql 8.3.17-0ubuntu0.8.04.1 object-relational SQL database (latest versi
ii postgresql-8.3 8.3.9-0ubuntu8.04 object-relational SQL database, version 8.3
ii postgresql-client 8.3.9-0ubuntu8.04 front-end programs for PostgreSQL (latest ve
ii postgresql-client-8.3 8.3.9-0ubuntu8.04 front-end programs for PostgreSQL 8.3
ii postgresql-client-common 87ubuntu2 manager for multiple PostgreSQL client versi