Skip to content

Instantly share code, notes, and snippets.

View qichunren's full-sized avatar
🌈
Focusing contribute

Qichunren qichunren

🌈
Focusing contribute
View GitHub Profile
             /Users/qichunren/.rvm/gems/ruby-1.9.2-p0/gems/rcov-0.9.9/lib/rcov/file_statistics.rb:115:in `block in is_code?': invalid byte sequence in US-ASCII (ArgumentError)

rcov 0.9.8

rake spec:rcov not work

How to fix it?

in file

if ActiveRecord::Base.connection.adapter_name != "Mysql2"
# in Gemfile
gem 'factory_girl_rails', "1.0.0"
# gem 'shoulda-matchers'
gem 'remarkable_activerecord', '>=4.0.0.alpha4'
# in spec/support/remarkable.rb
require 'remarkable/active_record'
# in a rspec test
#
sudo su
# 使用下面的命令启动 XAMPP:
/Applications/XAMPP/xamppfiles/xampp start
@qichunren
qichunren / new.html.erb
Created February 28, 2011 07:15
使用bbcode编辑器
<%= content_for :html_head do %>
<%= javascript_include_tag "jquery.bbcode.js" %>
<%= javascript_tag do %>
$(function(){
$("#web_message_content").bbcode({tag_bold:true,tag_italic:true,tag_underline:true,tag_link:true,tag_image:true,button_image:true,image_url:'/images/bbcode/'});
$("#bbcode_preview_btn").bind("click", function(){
var bbcode = $("#web_message_content").val();
$.get("/utils/parse_bbcode", {id:bbcode}, function(text){
@qichunren
qichunren / application_controller.rb
Created March 9, 2011 09:24
login from http basic authcation
class ApplicationController < ActionController::Base
USER_NAME, PASSWORD = "xx", "secret"
protect_from_forgery
before_filter :login_from_http_auth
protected
def login_from_http_auth
authenticate_or_request_with_http_basic do |user_name, password|
user_name == USER_NAME && password == PASSWORD
namespace :dev do
task :s do
sh "thin start -d -e production -p 5000"
end
task :stop do
sh "kill -9 `cat tmp/pids/thin.pid`"
end
@qichunren
qichunren / Capybara_demo.rb
Created March 24, 2011 06:57
这个用来测试业务流程操作,以test_开头的public方法都会执行
# encoding: utf-8
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
# require 'capybara/rspec'
Capybara.run_server = false
Capybara.current_driver = :selenium
Capybara.app_host = 'http://cqrorx.com:3000'
Capybara.default_wait_time = 4
@qichunren
qichunren / auto_pull.sh
Created April 28, 2011 01:55
运用expect自动输入密码
qichunren@ubuntu:~/repos$ cat auto_pull.sh
#!/usr/bin/expect
set timeout 30
cd /home/qichunren/repos/web_backend
spawn git pull --rebase
expect "[email protected]'s password:"
send "secretpassword\r"
send "\r"
sleep 10
@qichunren
qichunren / Readme.md
Created May 12, 2011 09:20
growlnotify