Skip to content

Instantly share code, notes, and snippets.

#/bin/sh
scrot -s -b -q 1 -e 'mv $f ~/桌面/'
@alvin2ye
alvin2ye / lint.rb
Created November 4, 2009 01:34 — forked from wycats/lint.rb
# You can test whether an object is compliant with the ActiveModel API by
# including ActiveModel::Lint::Tests in your TestCase. It will included
# tests that tell you whether your object is fully compliant, or if not,
# which aspects of the API are not implemented.
#
# These tests do not attempt to determine the semantic correctness of the
# returned values. For instance, you could implement valid? to always
# return true, and the tests would pass. It is up to you to ensure that
# the values are semantically meaningful.
#
@alvin2ye
alvin2ye / 11
Created November 4, 2009 01:59
Subject: Re: 列出所有好友的手机号 [flyerhzm/rfetion GH-7]
你可以调用下面的方法
<pre><code>
fetion = Fetion.new
fetion.logger_level = level
fetion.mobile_no = mobile_no
fetion.password = password
fetion.login
fetion.register
@alvin2ye
alvin2ye / 11
Created November 4, 2009 02:01
Subject: Re: 列出所有好友的手机号 [flyerhzm/rfetion GH-7]
你可以调用下面的方法
<pre><code>
fetion = Fetion.new
fetion.logger_level = level
fetion.mobile_no = mobile_no
fetion.password = password
fetion.login
fetion.register
^Q50,3
^W100
^H10
^P1
^S4
^AT
^C1
^R0
~Q+0
^O0
@alvin2ye
alvin2ye / gist:229280
Created November 8, 2009 13:59
rails templete
run "rm public/index.html"
generate(:nifty_layout, "application")
generate(:nifty_config, "")
generate(:nifty_authentication, "")
generate(:nifty_scaffold, "post title:string body:text")
route "map.root :controller => :posts"
rake("db:migrate")
git :init
@alvin2ye
alvin2ye / gist:229728
Created November 9, 2009 06:14
new git resp
# new git resp
1.
vi gitosis.conf
git ci -m "add new xxx"
git push
2.
git init
@alvin2ye
alvin2ye / ruby.rb
Created November 10, 2009 04:06 — forked from wycats/ruby.rb
class Person
attr_reader :name
def initialize(name = nil)
@name = name
end
def loud_name
@name.upcase
end
# state.rb 状态模式
class Connection
attr_accessor :state
def initialize
@state = TCPClose.new
end
def reset
@state = TCPClose.new
end
require 'test/unit'
class TestStatePattern < Test::Unit::TestCase
def test_1
c = Connection.new
assert_equal "根本就没连上", c.disconnect
assert_equal "正在连接", c.connect
assert_equal "已经连着了, 不用再连", c.connect
assert_equal "正在断开", c.disconnect