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
$KCODE = 'u' | |
# Goal: 小写金额转换为大写金额 | |
# Limit: 金额整数位支持到亿位,小数点后支持两位并且不支持四舍五入 | |
class ChineseFee | |
attr_reader :chn_numbers, :chn_units, :chn_decimals | |
def initialize | |
@chn_numbers = %w(零 壹 贰 叁 肆 伍 陆 柒 捌 玖) | |
@chn_units = %w(元 拾 佰 仟 万 拾万 佰万 仟万 亿) |
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
# These commands will help you setup the Rails test environment without problems | |
# | |
# MAKE SURE YOU HAVE VIRTUAL BOX INSTALLED http://www.virtualbox.org/wiki/Downloads | |
# | |
# Copy paste all of following commands in your normal terminal and the following things will happen: | |
# - rails_test_box dir is created | |
# - rails master branch is checkout in the dir rails | |
# - A Gemfile is created and all the gems to run the virtualbox are installed using bundler | |
# - The rails vagrant box is downloaded and added to your vagrant boxes | |
# - A Vagrantfile is created for vagrant |
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
# These commands will help you setup the Rails test environment without problems | |
# | |
# MAKE SURE YOU HAVE VIRTUAL BOX INSTALLED http://www.virtualbox.org/wiki/Downloads | |
# | |
# Copy paste all of following commands in your normal terminal and the following things will happen: | |
# - rails_test_box dir is created | |
# - rails master branch is checkout in the dir rails | |
# - A Gemfile is created and all the gems to run the virtualbox are installed using bundler | |
# - The rails vagrant box is downloaded and added to your vagrant boxes | |
# - A Vagrantfile is created for vagrant |
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
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html | |
Hi everyone, I'm Chris Wanstrath. | |
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But | |
then I took a few moments and thought, Wait, why? Why me? What am I supposed | |
to say that's interesting? Something about Ruby, perhaps. Maybe the | |
future of it. The future of something, at least. That sounds | |
keynote-y. | |
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
#此DEMO的功能:查询手机类的淘客商品 | |
require 'digest/md5' | |
require 'net/http' | |
require 'open-uri' | |
require 'iconv' | |
#获得当前时间 | |
t = Time.new(); | |
#组装参数 |
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
# 30 minutes Lisp in Ruby | |
# Hong MinHee <http://dahlia.kr/> | |
# | |
# This Lisp implementation does not provide a s-expression reader. | |
# Instead, it uses Ruby syntax like following code: | |
# | |
# [:def, :factorial, | |
# [:lambda, [:n], | |
# [:if, [:"=", :n, 1], | |
# 1, |
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
#include <iostream> | |
using namespace std; | |
void fun(int i) | |
{ | |
static int n = i ; | |
int *p = &n ; | |
cout << n << endl ; | |
++n ; | |
--p ; | |
*p = 0 ; |
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
#!/bin/bash | |
BACKUP_DIR='/home/rsync/mysql_backup' | |
MHOST='localhost' | |
MUSER='root' | |
MPASS='yourpass' | |
NOW=$(date +"%Y-%m-%d_%H") |
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
#!/bin/sh | |
suffix=$(date +%y%m%d) | |
password="pass" | |
user="user" | |
mkdir db | |
cd db | |
mysqldump -u$user -p$password blog > blog.$suffix.sql | |
mysqldump -u$user -p$password en > en.$suffix.sql |
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
#!/bin/bash | |
# Usage: | |
# ./server.sh domain.com(without www) | |
# ./server.sh helishi.net | |
if [ "$*" = "" ] | |
then | |
exit; | |
fi | |
OlderNewer