This file contains hidden or 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
function addComma(num) { | |
num = String(num); | |
var len = num.length; | |
var remainder = len % 3; | |
var h = num.substring(0, remainder); | |
var str = num.substring(remainder); | |
var i = 0; | |
var flag = str.length / 3; | |
var result = h ? [h] : []; | |
for (; i <f lag; i ++) { |
This file contains hidden or 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
# coding=utf-8 | |
''' svn post-commit hook. checkout the repository and synchronizate to the | |
working copy. you can add some feature that you demand, e.g. after all, restart | |
your web server persuades the code changes to take effect. | |
''' | |
import os | |
import logging | |
import sys |
This file contains hidden or 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
Boom.add('xstream', function(C) { | |
var TICKET = 'any random string 1'; | |
var PING = 'any random string 2'; | |
var PING_BACK = 'any random string 3'; | |
var host = location.protocol + '//' + location.host + | |
(location.port ? ':' + location.port : ''); | |
var $ = jQuery; | |
var win = window; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>html page</title> | |
</head> | |
<body> | |
<form> | |
userfile: <input type="file" /> <br /> | |
<progress max="100" value="0"></progress> <br /> |
This file contains hidden or 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
import os | |
import subprocess | |
import logging | |
import argparse | |
''' Make a python script as daemon. | |
Usage: | |
python daemon.py start|stop|restart | |
You can use this for some scenes such as subversion hooks or init.d |
This file contains hidden or 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
var reducerShape = {}; | |
var makeFinalStateByReducerShape = function(shape, path, result, state, | |
action) { | |
if (typeof shape === 'function') { | |
var obj = result; | |
var value = state; | |
for (var i = 0; i < path.length - 1; i++) { | |
var key = path[i]; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script type="text/javascript" src="http://vj0.6rooms.com/csjs/lib/tools/jquery/jquery-1.8.0.js"></script> | |
<script type="text/javascript" src="jMarquee.js"></script> | |
<style type="text/css"> | |
canvas { | |
float: left; | |
} |
This file contains hidden or 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
#!/usr/bin/env node | |
/** | |
* 此函数只为说明 immer.js 的基本实现方式(基于 ES6 Proxy 非 ES5),因此尽量保持简陋, | |
* 并且只支持普通对象,而且不能通过返回值的方式生成新对象, | |
* 也不能增加新属性。 | |
* 同时,也不支持 Array Map Set 等其他数据类型。 | |
*/ | |
// 存储 revoke 函数,用于释放 Proxy 对象资源。 |