Skip to content

Instantly share code, notes, and snippets.

@cuppster
cuppster / node-express-cors-middleware.js
Created April 9, 2012 16:02
express.js middleware to support CORS pre-flight requests
app.use(express.methodOverride());
// ## CORS middleware
//
// see: http://stackoverflow.com/questions/7067966/how-to-allow-cors-in-express-nodejs
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
@shenmao1989
shenmao1989 / sns_widget.js
Created October 18, 2013 05:15
历遍页面z-index 获取最大z-index
var max = 0;
var maxEle;
KISSY.each(KISSY.query('*'), function(i){
if(KISSY.DOM.css(i, 'z-index') == 'auto'){return;}
var index = parseInt(KISSY.DOM.css(i, 'z-index'));
if(max < index){
max = index;
maxEle = i;
}
console.log(index);
@soffchen
soffchen / surge.conf
Last active March 4, 2024 05:23
surge.conf
[General]
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
loglevel = notify
[Proxy]
BJ-All = custom
BJ-HK-Azure = custom
BJ-US-Azure = custom
@jason5ng32
jason5ng32 / surge.conf
Last active April 7, 2024 13:04
Surge Configs ( for 2.x )
[General]
loglevel = notify
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# dns-server = 119.29.29.29,223.5.5.5,114.114.115.115
# external-controller-access = PASSWORD@0.0.0.0:6155
# ipv6 = true
// REMEMBER TO CHANGE THE external-controller-access' PASSWORD
@shantur
shantur / MacPro-2013-GPU-Passthrough.txt
Last active July 4, 2024 03:01
MacPro 6,1 Late 2013 ESXi Ubuntu FirePro D700 / D500 passthough settings
ESXi Setup
1. Add to /etc/vmware/passthru.map
1002 6798 d3d0 default
1002 aaa0 d3d0 default
2. Run these commands
esxcli system settings kernel set -s vga -v FALSE
esxcli system settings kernel set -s iovDisableIR -v TRUE