Skip to content

Instantly share code, notes, and snippets.

View jkvim's full-sized avatar

Zehang Lin jkvim

View GitHub Profile
@jkvim
jkvim / nginx.conf
Last active August 21, 2017 03:41
Nginx static file server
server {
client_max_body_size 4G;
listen 80;
server_name localhost;
root /path/to/fileServer; # your folder to serve
location / {
types {
application/octet-stream txt; # specify which type force to download instead of open
}
auth_basic "Restricted";
@jkvim
jkvim / detect-ie.js
Created January 24, 2017 03:50
Detect IE version
var ie = (function() {
var v = 3
, div = document.createElement( 'div' )
, all = div.getElementsByTagName( 'i' )
do
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->'
while
(all[0])
return v > 4 ? v : document.documentMode
}())
@jkvim
jkvim / function_signature.js
Last active January 16, 2017 15:14
Duplicate Function Signature and Variable in JavaScript
// SyntaxError: foo has alreay been declared
const foo = (a, b) => {
console.log(a, b);
};
const foo = (a) => {
console.log(a);
};
foo(10, 100);