This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deb http://mirrors.163.com/ubuntu/ oneiric main universe restricted multiverse | |
deb-src http://mirrors.163.com/ubuntu/ oneiric main universe restricted multiverse | |
deb http://mirrors.163.com/ubuntu/ oneiric-security universe main multiverse restricted | |
deb-src http://mirrors.163.com/ubuntu/ oneiric-security universe main multiverse restricted | |
deb http://mirrors.163.com/ubuntu/ oneiric-updates universe main multiverse restricted | |
deb http://mirrors.163.com/ubuntu/ oneiric-proposed universe main multiverse restricted | |
deb-src http://mirrors.163.com/ubuntu/ oneiric-proposed universe main multiverse restricted | |
deb http://mirrors.163.com/ubuntu/ oneiric-backports universe main multiverse restricted | |
deb-src http://mirrors.163.com/ubuntu/ oneiric-backports universe main multiverse restricted | |
deb-src http://mirrors.163.com/ubuntu/ oneiric-updates universe main multiverse restricted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ruby-china | |
git remote add upstream git://github.com/huacnlee/ruby-china.git | |
git fetch upstream | |
git merge upstream/master | |
git push #you will update your forked repo now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/ | |
describe User do | |
subject { user } | |
let(:user) { User.new } | |
context "when name empty" do | |
it { should_not be_valid } | |
specify { user.save.should be_false } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height:100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding: utf-8 | |
require 'spec_helper' | |
describe "sign up and login" do | |
it "let user sign up and login to the site" do | |
visit '/' | |
click_link '注册' | |
fill_in '用户名', :with => 'jack' | |
fill_in 'Email', :with => '***@gmail.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// start service, only run once | |
public void init() throws ServletException { | |
ExecutorService service = Executors.newFixedThreadPool(1); | |
service.execute(new MyQueueHandler()); | |
super.init(); | |
} | |
public class MyQueue { | |
public static BlockingQueue EVENT_QUEUE = new LinkedBlockingQueue(); | |
public static void addToQueue(Obj obj) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script language="javascript"> | |
$(document).ready(function(){ | |
//华丽初始化 | |
$(".chzn-select").chosen(); | |
//单选select 数据同步 | |
chose_get_ini('#dl_chose'); | |
//change 事件 | |
$('#dl_chose').change(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
after_create { | |
begin | |
# 4 bytes => 32 bits => 4,294,967,296 unique values | |
self.profile_slug = ActiveSupport::SecureRandom.hex(4) | |
self.save! | |
rescue ActiveRecord::RecordNotUnique => e | |
retry | |
end | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ssh linode 'cd local_clone; cd happynewsdb; \ | |
mysqldump --extended-insert=FALSE --complete-insert=TRUE -uroot authlove_development>authlove_development.sql; \ | |
git commit -a -m"i"; \ | |
git push;\ | |
cd ../happyecdb/ ; \ | |
mysqldump --extended-insert=FALSE --complete-insert=TRUE -uroot ec_development>ec_development.sql; \ | |
git commit -a -m"i"; \ | |
git push;\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
module Net | |
class HTTP | |
def self.enable_debug! | |
raise "You don't want to do this in anything but development mode!" unless Rails.env == 'development' | |
class << self | |
alias_method :__new__, :new | |
def new(*args, &blk) | |
instance = __new__(*args, &blk) | |
instance.set_debug_output($stderr) |
OlderNewer