Skip to content

Instantly share code, notes, and snippets.

@saberma
saberma / _compound_datetime.html.slim
Created January 21, 2013 04:13
复合时间日期的样式测试
.control-group
label.control-label 开始时间
.controls.controls-row
.compound-datetime.row
.span2.input-append.pull-left
input.datepicker type="text" value="2013-01-20"
span.add-on
i.icon-calendar.datepicker-trigger
.span2
select.time-hour
@saberma
saberma / 12.10.quantal
Created December 22, 2012 11:56
163 ubuntu source list, lubuntu is the same
deb http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted
@saberma
saberma / gist:1094530
Created July 20, 2011 07:41
all integration error puts here
Failures:
1) Shop::Shops GET /products should show product
Failure/Error: choose '普通快递-¥10.0' #选择配送方式
Capybara::ElementNotFound:
cannot choose field, no radio button with id, name, or label '普通快递-¥10.0' found
# (eval):2:in `choose'
# ./spec/requests/shop/shops_spec.rb:53:in `block (3 levels) in <top (required)>'
2) Guides Task Payment should be complete
@saberma
saberma / douban.rb
Created July 16, 2011 10:24
douban api ruby
# -----------------------------------------------------------------
# 本程序提供最基本的Douban OAuth认证的Ruby示例代码
# 更多其他语言版本的Douban OAuth认证示例代码在 http://code.google.com/p/douban-oauth-sample/ 上提供
# 有任何疑问,可以到 http://www.douban.com/group/dbapi/ 上提问
# -----------------------------------------------------------------
# Douban OAuth认证包括以下四步内容
#
# 1. 获取Request Token
# 2. 用户确认授权
@saberma
saberma / gist:1006051
Created June 3, 2011 08:25
therubyracer Segmentation fault
/home/saberma/Documents/shopqi/vendor/bundle/ruby/1.9.1/gems/therubyracer-0.9.0beta3/lib/v8/context.rb:17: [BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
-- control frame ----------
c:0069 p:---- s:0357 b:0357 l:000356 d:000356 CFUNC :New
c:0068 p:0140 s:0354 b:0354 l:000353 d:000353 METHOD /home/saberma/Documents/shopqi/vendor/bundle/ruby/1.9.1/gems/therubyracer-0.9.0beta3/lib/v8/context.rb:17
c:0067 p:---- s:0347 b:0347 l:000346 d:000346 FINISH
c:0066 p:---- s:0345 b:0345 l:000344 d:000344 CFUNC :new
c:0065 p:0022 s:0342 b:0342 l:000341 d:000341 METHOD /home/saberma/Documents/shopqi/vendor/bundle/ruby/1.9.1/gems/coffee-script-2.1.3/lib/coffee_script.rb:135
c:0064 p:0025 s:0337 b:0337 l:000336 d:000336 METHOD /home/saberma/Documents/shopqi/vendor/bundle/ruby/1.9.1/gems/coffee-script-2.1.3/lib/coffee_script.rb:131
@saberma
saberma / mongoid-bug.rb
Created March 14, 2011 13:58
The query result of embedded document is inconsistent.
require 'mongoid'
class Address
include Mongoid::Document
embeds_many :locations
end
class Location
include Mongoid::Document
field :name
@saberma
saberma / get_gem_spec.rb
Created August 9, 2010 15:05
Could not find gem 'sentient_user (>= 0, runtime)' in any of the gem sources.
require 'rubygems/spec_fetcher'
files = { :latest => 'latest_specs',
:prerelease => 'prerelease_specs',
:all => 'specs' }
source = Gem.sources.first
all_gems = Gem::SpecFetcher.new.load_specs(URI.parse(source), files[:all]).map{|g| g[0]}
latest_gems = Gem::SpecFetcher.new.load_specs(URI.parse(source), files[:latest]).map{|g| g[0]}
@saberma
saberma / startup.sh
Created July 23, 2010 10:56
开机运行常用terminal
#!/bin/bash
#开机启动时快速进入开发环境
#chmod +x startup.sh
#一定要以login方式执行,否则不会加载~/.bashrc
#bash -l startup.sh
#增加Ubuntu的启动项:System-Perferences-Startup Applications
##2.开启chrome
chromium-browser &
@saberma
saberma / domains.rb
Created June 28, 2010 13:31
批量查询域名
#!/usr/bin/env ruby
# sudo apt-get install libnotify-bin
# gem install bulkdom
# gem install notify
require 'bulkdom'
require 'notify'
letters = File.read('letters').chomp
size = letters.size