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
import b, c | |
print __name__, ":", c.msg | |
print __name__, ":", c is b.c | |
print __name__, ":", "reload c" | |
reload(c) | |
print __name__, ":", c.msg | |
print __name__, ":", c is b.c |
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
var b = require('./b') | |
,c = require('./c'); | |
console.log(__filename, ":", c.msg); | |
console.log(__filename, ":", c === b.c); | |
console.log(__filename, ":", "delete require cache, and require c again"); | |
delete require.cache[require.resolve('./c')]; | |
c = require('./c'); |
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
# -*- coding: UTF-8 -*- | |
from flaskext.wtf import Form, TextField, PasswordField, RecaptchaField, \ | |
AnyOf, NoneOf, Regexp, Email, Required, EqualTo, Recaptcha | |
from wtforms.validators import StopValidation | |
from flask import request, session | |
import model | |
# 身份證字號格式驗證 | |
def check_ID(form, field): | |
locations = dict(zip([c for c in 'ABCDEFGHJKLMNPQRSTUVXYWZIO'], range(10,36))) |
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
IF "%GOCC_OLD_PATH%" NEQ "" GOTO restorepath | |
:savepath | |
ECHO save PATH to GOCC_OLD_PATH | |
SET GOCC_OLD_PATH=%PATH% | |
GOTO oldpathdone | |
:restorepath | |
ECHO restore PATH from GOCC_OLD_PATH | |
PATH %GOCC_OLD_PATH% |
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
(function () { | |
var hiresurl, | |
hiresimg; | |
hiresurl = function hiresurl (source) { return source.replace(/\/s\d+\//i, "/s0/"); }; | |
hiresimg = function hiresimg (){ | |
var imgs = document.getElementsByTagName("img"), | |
len = imgs.length, | |
img; |
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
var fs = require('fs'), | |
cluster = require('cluster'); | |
var config = JSON.parse(fs.readFileSync(require('path').join(__dirname, 'config.json'))); | |
if (config.cwd && process.cwd() != config.cwd) process.chdir(config.cwd); | |
var workers = config.workers || require('os').cpus().length; | |
// 如有指定 log 檔,則將標準輸出和錯誤輸出寫到 log 檔 | |
if (config.log){ | |
var log_stream = fs.createWriteStream(config.log, {flags: 'a'}); |
NewerOlder