Skip to content

Instantly share code, notes, and snippets.

View vangie's full-sized avatar

Vangie Du vangie

View GitHub Profile
@vangie
vangie / rmb.coffee
Created March 2, 2014 12:04
人民币小写转换为大写
#! /usr/bin/env coffee
# convert amount from figures to words
# @author vangie.du
# @url http://codelife.me/blog/2013/03/09/convert-amount-from-figures-to-words-by-coffeescript/
# @version 1.1
# @since 2013-03-09
if process.argv.length >= 3
n = parseFloat(process.argv[2]).toFixed(2)
@vangie
vangie / vagex.php
Created March 6, 2014 11:55
vagex script by php
<?php
date_default_timezone_set('Asia/Shanghai');
define('DEFAULT_UA', 'Mozilla/5.0 (Windows NT 6.1; rv:25.0) Gecko/20100101 Firefox/25.0');
if (PHP_SAPI !== 'cli') {
die ("This is CLI only version!");
} else {
$v = new Vagex();
$v->set_userid('263378');
@vangie
vangie / install-vagex-centos6.sh
Last active August 29, 2015 13:57
install vagex on bandwagonhost centos6
yum update -y
yum install php-cli -y
wget https://gist.githubusercontent.com/horsley/12a14498e02c994e0664/raw/a6e0dc785f2a17353860b02b163b5386a3823efa/VagexRobot.AllInOne.php
sed -i "s/240907/$1/" VagexRobot.AllInOne.php
screen -dmS vagex php VagexRobot.AllInOne.php
(crontab -u root -l; echo "@daily screen -X -S vagex quit; screen -dmS vagex php VagexRobot.AllInOne.php" ) | crontab -u root -
@vangie
vangie / header_encoded
Created April 4, 2014 14:41 — forked from jpadilla/header_encoded
JSON Web Token
eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9
@vangie
vangie / 01_kivivm.js
Last active August 29, 2015 14:01
kivivm设置脚本
/**
* kivivm设置脚本
*
* 在浏览器控制台执行,可以设定域名解析,反向域名解析
* 控制台输出如下结构,包括root密码,ssh端口号,IP地址,
*
* "www" => { "passwd" => "vd7sdfMfwdz", "port" => "26212", "ips" => %w(101.182.180.163 137.182.180.204 107.184.180.214 107.122.181.209)}
*
* 可用于kivivm.rb脚本设定
* DNSPod的域名解析
#!/bin/bash
#Auto-reconnecting wget downloads upon disconnection.
WGET="wget -c -t 0 --timeout=3 --waitretry=3"
mkdir -p "地球往事" && cd $_
for i in {1..49}
do
$WGET "http://jwplay.iusheng.com/AS03/audio1206/15548/$(printf "%03d" $i).mp3"
done
@vangie
vangie / drop_tabels.sql
Last active August 29, 2015 14:12
Drop all tables of current database in MySQL
SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN=32768;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables,'dummy') INTO @tables;
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;
@vangie
vangie / gist:2592085
Created May 4, 2012 04:43
how to implement this._super in js function
// tests if we can get super in .toString()
fnTest = /xyz/.test(function() {
xyz;
}) ? /\b_super\b/ : /.*/,
// overwrites an object with methods, sets up _super
// newProps - new properties
// oldProps - where the old properties might be
// addTo - what we are adding to
inheritProps = function( newProps, oldProps, addTo ) {
@vangie
vangie / extending-the-defaults-of-a-model-superclass-in-backbone-js
Created June 23, 2012 18:06
Extending the defaults of a Model superclass in Backbone.js
var ExtendedInventory = Inventory.extend({
defaults: {
rabit:25
}
});
_.extend(ExtendedInventory.prototype.defaults, Inventory.prototype.defaults);
// or
@vangie
vangie / gist:3087862
Created July 11, 2012 03:44
text-overflow
white-space:nowrap;
overflow:hidden;
text-overflow: clip | ellipsis | ellipsis-word;