Skip to content

Instantly share code, notes, and snippets.

View huobazi's full-sized avatar
🎯
Focusing

Marble Wu huobazi

🎯
Focusing
View GitHub Profile
@huobazi
huobazi / MongoDB install
Created May 17, 2011 06:44 — forked from rafi/MongoDB install
MongoDB install
wget http://downloads.mongodb.org/linux/mong … -1.2.0.tgz
tar xvfz mongodb-linux-i686-1.2.0.tgz -C /usr/local/softnix/
mv mongodb-linux-i686-1.2.0/ mongodb
mkdir -p /data/db
ln -s /usr/local/softnix/mongodb/bin/mongod /sbin/mongod
ln -s /usr/local/softnix/mongodb/bin/mongo /bin/mongo
./mongod &
./mongo
@huobazi
huobazi / mongo_backup.rb
Created May 17, 2011 06:55 — forked from freegenie/mongo_backup.rb
Backup solution for mongodb which dumps gridfs items on filesystem
#!/usr/bin/env ruby
# This script is a backup tool for mongodb.
#
# The main purpose is to dump files from gridfs to filesystem,
# to take advantage of backup solutions based on tools like
# rsync.
# Developed against mongo 1.6.0
@huobazi
huobazi / new-clearfix.css
Created May 18, 2011 07:27 — forked from jmblog/new-clearfix.css
new clearfix
/* new clearfix */
/* http://perishablepress.com/press/2009/12/06/new-clearfix-hack/ */
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
@huobazi
huobazi / gist:997385
Created May 29, 2011 01:45
NERDTree Keys
111 o.......在已有窗口中打开文件、目录或书签,并跳到该窗口 .....|NERDTree-o|
112 go......在已有窗口中打开文件、目录或书签,但不跳到该窗口 .....|NERDTree-go|
113 t.......在新Tab中打开选中文件/书签,并跳到新Tab .....|NERDTree-t|
114 T.......在新Tab中打开选中文件/书签,但不跳到新Tab .....|NERDTree-T|
115 i.......split一个新窗口打开选中文件,并跳到该窗口 .....|NERDTree-i|
116 gi......split一个新窗口打开选中文件,但不跳到该窗口 .....|NERDTree-gi|
117 s.......vsp一个新窗口打开选中文件,并跳到该窗口 .....|NERDTree-s|
118 gs......vsp一个新窗口打开选中文件,但不跳到该窗口 .....|NERDTree-gs|
119 !.......执行当前文件 .....|NERDTree-!|
120 O.......递归打开选中结点下的所有目录 .....|NERDTree-O|
@huobazi
huobazi / gist:997492
Created May 29, 2011 05:09 — forked from dstufft/gist:997475
Configuration Files for Nginx + Gunicorn + Supervisord
We couldn’t find that file to show.
@huobazi
huobazi / ubuntu-setup.sh
Created May 29, 2011 05:15 — forked from addamh/ubuntu-setup.sh
NORMES Ubuntu Development System Bootstrap Script
#!/bin/bash
echo "Updating Packages..."
apt-get -qq -y update
echo "Installing Vim..."
apt-get -qq -y install vim-gnome
echo "Installing Utilities..."
apt-get -qq -y install curl bison build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2-dev
@huobazi
huobazi / bootstrap.sh
Created May 29, 2011 05:15 — forked from addamh/bootstrap.sh
NORMES MacOSX Development System Bootstrap Script
#!/usr/bin/env bash
echo "Fixing Samba..."
echo "[default]" > ~/Library/Preferences/nsmb.conf
echo "streams=no" >> ~/Library/Preferences/nsmb.conf
echo "Removing System Gems..."
rm -r /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
gem update --system
gem clean
class User
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Document::ProtectedAttributes
attr_protected :password_hash, :password_salt
attr_accessor :password, :password_confirmation
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
flash[:notice] = "Thank you for signing up! please activate your account using the link we just sent to your email address."
redirect_to root_url
@huobazi
huobazi / gist:1000137
Created May 31, 2011 08:05
双色球选号器
def rand_array(arr)
rand_arr = []
temp_arr = []
s = arr.size-1
for i in 0..s
r=rand(s+1)
if temp_arr[r] != 1
rand_arr.push(arr[r])
temp_arr[r] = 1