Skip to content

Instantly share code, notes, and snippets.

@wangye
wangye / DynamicObject.vbs
Created October 9, 2012 12:03
ASP/VBScript Dynamic Object Generator ASP/VBScript动态创建属性对象的工厂类
'
' ASP/VBScript Dynamic Object Generator
' Author: WangYe
' For more information please visit
' http://wangye.org/
' This code is distributed under the BSD license
'
' UPDATE:
' 2012/11/7
' 1. Add variable key validator.
@wangye
wangye / TinyCache.js
Created September 26, 2012 06:13
JScript TinyCache for Classic ASP
// Author : wangye
// For more information please visit http://wangye.org/blog/archives/706/
var RawCache = function() {
this.setItem = function(key, value) {
Application.Lock();
Application.Contents(key) = value;
Application.Unlock();
};
this.getItem = function(key, defvalue) {
@wangye
wangye / DataHelper.py
Created September 1, 2012 05:51
SQLite3数据库辅助类(查询构造器)
import sqlite3
# ***************************************************
# *
# * Description: Python操作SQLite3数据库辅助类(查询构造器)
# * Author: wangye
# * Website: http://wangye.org
# *
# ***************************************************
@wangye
wangye / DateParser.py
Created August 30, 2012 12:28
DateParser.py 非标准的日期字符串处理
import re
import datetime
# ***************************************************
# *
# * Description: 非标准的日期字符串处理
# * Author: wangye <pcn88 at hotmail dot com>
# * Website: http://wangye.org
# *
# ***************************************************
@wangye
wangye / search.vbs
Created May 11, 2012 02:13
Search Text in Word or Excel Documents
'
' Author: wangye
' For more information please visit
' http://wangye.org/blog/archives/591/
'
Option Explicit
Dim hasMatchCase
Dim hasRecursion
@wangye
wangye / FileOperation.vbs
Created March 21, 2012 11:03
VBScript Scripting.FileSystemObject enumerate directory folder or file
Class FileOperation
Private AxFile
Private Sub Class_Initialize()
Set AxFile = WSH.CreateObject("Scripting.FileSystemObject")
End Sub
Private Sub Class_Terminate()
Set AxFile = Nothing
End Sub
@wangye
wangye / redirect.php
Created March 7, 2012 02:56
PHP 301 url redirect
<?php
// http://wangye.org/blog/archives/4/
// 定义你自己的URL路由表
// 比如下面的路由表将会把
// read.php?paramA=1&paramB=2&paramC=3
// 变成
// /post/1/2/3/
$router = array(
'read.php'=>'/post/'
);
@wangye
wangye / PathFunc.vbs
Created March 7, 2012 02:50
VBScript Path Functions
'
' Author: wangye
' For more information please visit
' http://wangye.org/blog/archives/250/
'
Function PathRemoveFileSpec1(strFileName)
' 将类Unix路径 / 替换为 \
strFileName = Replace(strFileName, "/", "\")
Dim iPos
@wangye
wangye / GetSysInstDate.vbs
Created March 7, 2012 02:46
VBScript Get Windows OS installation date
Option Explicit
Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_DWORD = 4
Function VBMain()
Dim strComputer, strKeyPath, lngValue, Registry
strComputer = "."
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
@wangye
wangye / cObjectManager.class.vbs
Created March 7, 2012 02:45
VBScript Object Manager
'
' Author : wangye
' For more information please visit:
' http://wangye.org/blog/archives/267/
'
Class cObjectManager
Public IsPersist
Private objHost
Private objDict