Skip to content

Instantly share code, notes, and snippets.

View qichunren's full-sized avatar
🌈
Focusing contribute

Qichunren qichunren

🌈
Focusing contribute
View GitHub Profile
[2011-11-30 15:09:38] make
gcc -isysroot /Developer/SDKs/MacOSX10.7.sdk -arch i386 -fno-common -pipe -L. -Wl,-syslibroot /Developer/SDKs/MacOSX10.7.sdk -arch i386 -Wl,-u,_objc_msgSend main.o dmydln.o dmyencoding.o dmyversion.o miniprelude.o array.o bignum.o class.o compar.o complex.o dir.o dln_find.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o math.o node.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o time.o transcode.o util.o variable.o compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o dmyext.o -lpthread -ldl -lobjc -o miniruby
rbconfig.rb unchanged
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./enc/make_encmake.rb --builtin-encs="ascii.o us_ascii.o unicode.o utf_8.o" --builtin-transes="newline.o" enc.mk
./miniruby -I./lib -I.ext/c
caojinhua:lifepark caojinhua$ rails s -p 3001
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3001
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-12-05 16:53:50] INFO WEBrick 1.3.1
[2011-12-05 16:53:50] INFO ruby 1.9.2 (2011-07-09) [x86_64-darwin11.2.0]
[2011-12-05 16:53:50] INFO WEBrick::HTTPServer#start: pid=48579 port=3001
[FATAL] failed to allocate memory
@qichunren
qichunren / gist:1450038
Created December 9, 2011 03:38
MySQL server提示信息,不能远程连接数据库。
安装完MySQL后,远程连接数据库的时候,出现 ERROR 1130 (HY000): Host '192.168.0.32'is not allowed to connect to this MySQL server提示信息,不能远程连接数据库。
于是在网上搜了下
用下面的方法解决:
这个时候只要在MySQL服务器上登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"(或新增一条记录),正式环境建议指定为应用服务器的IP地址,比如'192.168.0.32'。
mysql -u root -pvmware
mysql>use mysql;
mysql>update user set host = '%' where user = 'root'; //这个命令执行错误时可略过
@qichunren
qichunren / c
Created December 15, 2011 07:56
qichunren@qichunren-desktop:~/github/cutycapt/CutyCapt$ ./CutyCapt
-----------------------------------------------------------------------------
Usage: CutyCapt --url=http://www.example.org/ --out=localfile.png
-----------------------------------------------------------------------------
--help Print this help page and exit
--url=<url> The URL to capture (http:...|file:...|...)
--out=<path> The target file (.png|pdf|ps|svg|jpeg|...)
--out-format=<f> Like extension in --out, overrides heuristic
--min-width=<int> Minimal width for the image (default: 800)
--min-height=<int> Minimal height for the image (default: 600)
@qichunren
qichunren / curl_post_register_data.txt
Created December 19, 2011 07:38
user register to ruby-china with post josn data
curl -d "user[login]=hello_guest&user[password]=justpasserror&user[password_confirmation]=justpasserror&user[email][email protected]" http://localhost:3001/account.json
{"_id":3,"created_at":"2011-12-19T15:36:48+08:00","current_sign_in_at":"2011-12-19T15:36:48+08:00","current_sign_in_ip":"127.0.0.1","email":"[email protected]","encrypted_password":"$2a$10$obXkqpBi7jkgZ7f3/wNEaOWHY55vs6a6RVdHOLJEus8/nxg2ZO8a6","follower_ids":[],"following_ids":[],"following_node_ids":[],"guest":false,"last_sign_in_at":"2011-12-19T15:36:48+08:00","last_sign_in_ip":"127.0.0.1","likes_count":0,"login":"hello_guest","replies_count":0,"sign_in_count":1,"state":1,"topics_count":0,"updated_at":"2011-12-19T15:36:48+08:00","verified":true}
@qichunren
qichunren / db_connections.rb
Created December 20, 2011 10:30
mutil database connection in rails
# encoding: utf-8
class DbConnections
def self.set_connection(db)
Post.establish_connection({
:adapter => "sqlite3",
:database => "db/development_#{db}.sqlite3",
:pool => 5,
:timeout => 5000
})
end
@qichunren
qichunren / carrierwave.rb
Created December 21, 2011 06:52 — forked from yortz/carrierwave.rb
image_uploader.rb
#config/initializers/carrierwave.rb
CarrierWave.configure do |config|
if Rails.env.production? or Rails.env.development?
config.storage :cloud_files
config.cloud_files_username = "your_username"
config.cloud_files_api_key = "your_key"
config.cloud_files_container = "test"
config.cloud_files_cdn_host = "c0012345.cdnn.cloudfiles.rackspacecloud.com"
def store_dir
@qichunren
qichunren / mutil_select.html.erb
Created December 23, 2011 08:35
mutil select
<div class="field">
<%= f.label :food_ids %><br />
<%= f.collection_select :food_ids, Food.all, "id", "name", {}, {:multiple => true} %>
</div>
@qichunren
qichunren / api.rb
Created February 27, 2012 08:16
ruby china api
module RubyChina
class API < Grape::API
version 'v1', :using => :header, :vendor => 'ruby_china', :format => :json
helpers do
def warden
env['warden']
end
@qichunren
qichunren / php_tree.php
Created April 8, 2012 12:33
show file tree with php lang
// http://www.codingforums.com/showthread.php?t=71882
function getDirectory( $path = '.', $level = 0 ){
$ignore = array( 'cgi-bin', '.', '..' );
// Directories to ignore when listing output. Many hosts
// will deny PHP access to the cgi-bin.
$dh = @opendir( $path );
// Open the directory to the handle $dh