Service | SSL | status | Response Type | Allowed methods | Allowed headers |
---|
http { | |
... | |
# redirect map in http block - remove fbclid argument from the end | |
map $request_uri $redirect_fbclid { | |
"~^(.*?)([?&]fbclid=[a-zA-Z0-9_-]+)$" $1; | |
} | |
... |
(function (w, timeout) { | |
setTimeout(function () { | |
var url = w.location.toString(); | |
if (w.history && w.history.replaceState && url.indexOf('_fid=') !== -1) { | |
w.history.replaceState({}, null, /[?&]_fid=[^&]+$/.test(url) | |
? url.replace(/[?&]_fid=[^&]+/, '') | |
: url.replace(/([?&])_fid=[^&]+&/, '$1') | |
); | |
} | |
}, timeout || 2000); |
int doubler(int x) { | |
return 2 * x; | |
} |
<?php | |
function pearson_correlation($x,$y){ | |
if(count($x)!==count($y)){return -1;} | |
$x=array_values($x); | |
$y=array_values($y); | |
$xs=array_sum($x)/count($x); | |
$ys=array_sum($y)/count($y); | |
$a=0;$bx=0;$by=0; | |
for($i=0;$i<count($x);$i++){ |
String.prototype.hashCode = function() { | |
var hash = 0, i, chr, len; | |
if (this.length === 0) return hash; | |
for (i = 0, len = this.length; i < len; i++) { | |
chr = this.charCodeAt(i); | |
hash = ((hash << 5) - hash) + chr; | |
hash |= 0; // Convert to 32bit integer | |
} | |
return hash; | |
}; |
This is a ServiceWorker template to turn small github pages into offline ready app.
Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html
file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js
files). I wanted to cache these files so that I can access my tools offline as well.
Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS
of your repository.
server { | |
... | |
listen 443 ssl; | |
listen 80; | |
if ($server_port = 80) { | |
set $xp A; | |
} |
I had some trouble with this character in a client project, it was hidden inside a configuration string which is validated in the clients API. It's basically invisible, literally a space character with zero width, it could not be seen but it was breaking at the API because it would not validate, causing problems with hundreds of user accounts.
The Unicode value of this character is U+200B
, and it's evil, very evil. Lying in wait to break your applications while leaving no sign of it's presence...
It also has some friends, check the answer of this Stack Overflow question
In my project, it was one of my colleuges who managed to find the character, he re-copied the string into the code and Git showed that the line had been changed, even though all the Git GUI's didn't actually show any difference. He ran git diff
in the command line and this did show the Unicode character being deleted, that's somet