RegExp Match All

RegExp.prototype.execAll = function(string) {
var match = null;
var matches = new Array();
while(match = this.exec(string)) {
var matchArray = [];
for(i in match) {
if(parseInt(i) == i) {
matchArray.push(match[i]);
}
}
matches.push(matchArray);
}
return matches;
}
// Example
var someTxt = 'abc123 def456 ghi890';
var results = /[a-z]+(\d+)/g.execAll(someTxt);
// Output
// [
// ["abc123", "123"],
// ["def456", "456"],
// ["ghi890", "890"]
// ]
view raw gistfile1.js hosted with ❤ by GitHub

How can I match multiple occurrences with a regex in JavaScript similar to PHP's preg_match_all()? - Stack Overflow

Firefox Memory Cache

browser.cache.disk.capacity: 0

browser.cache.disk.enable: false

browser.cache.memory.enable: true

browser.cache.memory.capacity: 128000
註:KB 為單位

privacy.clearOnShutdown.cache: false
註:要設為 false 才可以回存

[備忘] 設定 Firefox 17 Cache Memory | Kenmingの鮮思維

Download.ashx

Dim strFileName As String = "demo.txt"
Dim strFilePath As String = System.Web.HttpContext.Current.Server.MapPath("UploadFiles\") & strFileName
context.Response.ClearHeaders()
context.Response.Clear()
context.Response.Expires = 0
context.Response.Buffer = True
context.Response.AddHeader("Accept-Language", "zh-tw")
context.Response.AddHeader("content-disposition", "attachment; filename=" + HttpUtility.UrlEncode(strFileName))
context.Response.ContentType = "application/octet-stream"
context.Response.WriteFile(strFilePath)
context.Response.End()
view raw gistfile1.vb hosted with ❤ by GitHub

php環境設定 (使用Built-in web server)

  1. 下載Windows 5.4.14 Binaries Releases
  2. 解壓縮至C:\php
  3. 設定環境變數%php% → C:\php
  4. 設定php.inidate.timezone = Asia/Taipei
  5. 使用Built-in web server PHP -S Localhost:8000 -t X:\web | START http://Localhost:8000 -S <addr>:<port> Run with built-in web server.
    -t <docroot>     Specify document root <docroot> for built-in web server.

[folder] Jpg90

@ECHO OFF
SET PATH="D:\JpgTools\ImageMagick"
SET PATH=%PATH%;C:\WINDOWS\system32
FOR %%i IN ("%~1\*.jpg") DO (
convert -quality 90 "%%~i" "%%~i"
ECHO %%~nxi
)
PING 127.0.0.1 -n 3 -w 1000 >NUL
view raw gistfile1.bat hosted with ❤ by GitHub

StringBuffer (js字串連接效能問題)

function StringBuffer () {
this._strings_ = new Array();
}
StringBuffer.prototype.append = function(str) {
this._strings_.push(str);
};
StringBuffer.prototype.toString = function() {
return this._strings_.join("");
};
view raw gistfile1.js hosted with ❤ by GitHub

你不得不知道的關於JavaScript 中字符串連接的性能問題 - 黃明恩 - 博客園

Batch Delay(Wait, Sleep) (批次檔延遲)

ping 127.0.0.1 -n 5 -w 1000 > nul
The Will Will Web | 如何在批次檔(Batch)中實現 sleep 命令讓任務暫停執行 n 秒

Visual Studio 環境設定

devenv.exe /nosplash
環境 → 一般 → 動畫環境工具 → 取消勾選
環境 → 一般 → 啟動 → 啟動時 → 顯示空白環境
專案和方案 → 在方案總管中追蹤現用項目 → 取消勾選
文字編輯器 → 追蹤修訂 → 取消勾選
The Will Will Web | 加快 Visual Studio 執行速度與提升工作效率

Wordsmith (bookmarklet)

javascript: (function() {
var el = document.createElement('div'),
b = document.getElementsByTagName('body')[0],
msg = '';
el.id = 'jq-nk-mod';
el.style.position = 'fixed';
el.style.height = '30';
el.style.width = '200';
el.style.margin = '5px';
el.style.top = '0';
el.style.left = '0';
el.style.padding = '5px';
el.style.backgroundColor = '#F99';
el.style.color = '#000';
el.style.borderRadius = '5px';
el.style.zIndex = 1001;
el.innerHTML = msg;
getScript('http://code.jquery.com/jquery.min.js', function() {
if(typeof jQuery == 'undefined') {
msg = 'Sorry, but jQuery wasn\'t able to load';
showMsg();
} else {
getScript('http://getwordsmith.co/downloads/wordsmith.min.js?v=1.01', function() {
jQuery('body').wordsmith({
maxWordLength: 600,
popupWidth: 800,
popupHeight: 300,
lookupMessage: '查詢這單字的解釋',
lookupUrl: 'http://translate.google.com.tw/#auto/zh-TW/{word}'
});
msg = 'Wordsmith';
showMsg();
});
}
});
function getScript(url, success) {
var script = document.createElement('script');
script.src = url;
var head = document.getElementsByTagName('head')[0],
done = false;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function() {
if(!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
done = true;
success();
script.onload = script.onreadystatechange = null;
head.removeChild(script);
}
};
head.appendChild(script);
}
function showMsg() {
el.innerHTML = msg;
b.appendChild(el);
window.setTimeout(function() {
if(typeof jQuery == 'undefined') {
b.removeChild(el);
} else {
jQuery(el).fadeOut('slow', function() {
jQuery(this).remove();
});
if(otherlib) {
$jq = jQuery.noConflict();
}
}
}, 2500);
}
})();
view raw gistfile1.js hosted with ❤ by GitHub

Wordsmith [jQ]Wordsmith 1.01 | 男丁格爾's 脫殼玩