Skip to content

Instantly share code, notes, and snippets.

@dlueth
dlueth / arguments.convert.array.js
Last active January 2, 2018 15:25
JavaScript: Convert a functions array-like arguments to array
/*
* Works on e.g.: arguments (cross-browser)
* Does not work on e.g.: NodeList like from "document.getElementsByTagName"
*/
function foo() {
var args = [].slice.call(arguments, 0);
}
@dlueth
dlueth / loop.for.i.js
Last active January 2, 2018 15:25
JavaScript: Best practice "for i" loop
var values = [ 'entry 1', 'entry 2', 'entry 3' ], i, value;
for(i = 0; (value = entry[i]) !== undefined; i++) {
// do whatever you want in here :)
}
@dlueth
dlueth / .htaccess
Created June 13, 2013 12:16
Unset all cookies via Apache .htaccess
Header unset Cookie
Header unset Set-Cookie
@dlueth
dlueth / .htaccess
Created June 13, 2013 12:14
Cross domain font embedding for Firefox via Apache .htaccess
<FilesMatch "\.(ttf|otf|eot|woff|svg)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>