Skip to content

Instantly share code, notes, and snippets.

View liwh's full-sized avatar
🎯
Focusing

robie lee liwh

🎯
Focusing
View GitHub Profile
@liwh
liwh / gh-like.css
Created October 25, 2011 08:28 — forked from robsimmons/gh-like.css
GitHub-esque syntax highlight CSS
/*
Some simple Github-like styles, with syntax highlighting CSS via Pygments.
*/
body{
font-family: helvetica, arial, freesans, clean, sans-serif;
color: #333;
background-color: #fff;
border: none;
line-height: 1.5;
margin: 2em 3em;
@liwh
liwh / gist:1274665
Created October 10, 2011 05:03
intergration test
1) Blogs GET /admin/blogs works!
Failure/Error: page.should_not have_content('新品上市')
Selenium::WebDriver::Error::InvalidSelectorError:
The given selector "./descendant-or-self::*[contains(normalize-space(.), '新品上市')] is either invalid or does not resultin a Webelement. The following error occurred:
[InvalidSelectorError] Unable to locate elements with the xpath expression ./descendant-or-self::*[contains(normalize-space(.), '新品上市')] because of the following error:
[Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMXPathEvaluator.createNSResolver]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: resource://fxdriver/modules/atoms.js :: <TOP_LEVEL> :: line 2360" data: no]
# [remote server] file:///var/folders/l9/qg4tlk6130nb1dg_z9dpzygh0000gn/T/webdriver-profile20111010-2713-1ks2732/extensions/[email protected]/components/driver-component.js -> file:///var/folders/l9/qg4tlk6130nb1dg_z9dpzygh0000gn/T/we
%h3
%a{:href => "#"} Using Shopify
#using-shopify.drop
%h4 Intro to Shopify
%ul
%li
%a{:href => "http://wiki.shopify.com/Getting_Started", :title => "Getting Started - Shopify Wiki"} Getting Started
@liwh
liwh / aa.js
Created September 14, 2011 11:05
// This assumes you're using jQuery. This does the heavy lifting.
function setPlaceholderText() {
var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
return;
}
$(':input[placeholder]').each(function() {
var el = $(this);
var text = el.attr('placeholder');
Failures:
1) Blogs GET /admin/blogs works!
Failure/Error: page.should_not have_content('新品上市')
Selenium::WebDriver::Error::InvalidSelectorError:
The given selector "./descendant-or-self::*[contains(normalize-space(.), '新品上市')] is either invalid or does not resultin a Webelement. The following error occurred:
[InvalidSelectorError] Unable to locate elements with the xpath expression ./descendant-or-self::*[contains(normalize-space(.), '新品上市')] because of the following error:
[Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMXPathEvaluator.createNSResolver]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: resource://fxdriver/modules/atoms.js :: <TOP_LEVEL> :: line 2360" data: no]
# [remote server] file:///var/folders/aa/aavmOb6kFUeg9LeyZhjyT++++TI/-Tmp-/webdriver-profile20110913-12462-bqtafs/extensions/[email protected]/components/driver-component.js -> file:///var/folders/aa/aavmOb6kFUeg9LeyZhjyT+++
@liwh
liwh / gist:1195027
Created September 5, 2011 13:49
rails 3.1 changelog for dup method
# ActiveRecord::Base#dup and ActiveRecord::Base#clone semantics have changed to closer match normal Ruby dup and clone semantics.
# Calling ActiveRecord::Base#clone will result in a shallow copy of the record, including copying the frozen state. No callbacks will be called.
# Calling ActiveRecord::Base#dup will duplicate the record, including calling after initialize hooks. Frozen state will not be copied, and all associations will be cleared. A duped record will return true for new_record?, have a nil id field, and is saveable.
@liwh
liwh / gist:1188679
Created September 2, 2011 14:08
district
@RegionUtils =
init: (seed = [], region = '.region') ->
$(region).each ->
selects = $('select', this)
selects.unbind('change') # 避免多次绑定change事件
selects.change ->
$this = this
select_index = selects.index($this) + 1
select = selects.eq(select_index)
if $(this).val() and select[0]
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
@liwh
liwh / gist:1022751
Created June 13, 2011 13:20
install coreseek on mac os
  1. 按照coreseek网站上的安装步骤没装上,所以采用了下面的安装方式,安装成功!

sudo port install autoconf263 libtool-devel m4 autoconf automake libtool

cd mmseg-3.2.14
aclocal && glibtoolize —copy —force —ltdl && autoreconf -i -f && automake —a && ./configure —prefix=/usr/local/mmseg3 && make && sudo make install

cd ../csft-3.2.14
./configure —prefix=/usr/local/coreseek —without-unixodbc —with-mmseg —with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ —with-mmseg-libs=/usr/local/mmseg3/lib/ —with-pgsql

sudo port install autoconf263 libtool-devel m4 autoconf automake libtool

aclocal && glibtoolize —copy —force —ltdl && autoreconf -i -f && automake —a && ./configure —prefix=/usr/local/mmseg3 && make && sudo make install

./configure —prefix=/usr/local/coreseek —without-unixodbc —with-mmseg —with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ —with-mmseg-libs=/usr/local/mmseg3/lib/ —with-pgsql

make && sudo make install