const factorial = (n) => {
return (n === 0) ? 1 : n * factorial(n-1);
}
const factorial = (n) => {
const iter = (counter, acc) => {
return (counter === 0) ? acc : iter(counter - 1, counter * acc);
}
return iter (n, 1);
}
function flatDeep(arr) {
return arr.reduce((flattenArray, element) => {
return Array.isArray(element) ? [...flattenArray, ...flatDeep(element)] : [...flattenArray, element]
}, [])
}
console.log(flatDeep([1, 2, 3, [4, [[[5, [6, 7]]]], 8]])) // [1, 2, 3, 4, 5, 6, 7, 8]
<IfModule mod_setenvif.c>
# Vary: Accept for all the requests to jpeg and png
SetEnvIf Request_URI "\.(jpe?g|png)$" REQUEST_image
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# Check if browser supports WebP images
RewriteCond %{HTTP_ACCEPT} image/webp
# Check if WebP replacement image exists
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
# Serve WebP image instead
RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REQUEST_image
</IfModule>
<IfModule mod_mime.c>
AddType image/webp .webp
</IfModule>
let s = 0
for (var x = 0; x < imgW; x++) {
for (var y = 0; y < imgH; y++) {
s += x + y * 80;
var c = ImDat.getPixel(x, y);
var r = (c.R + s) % 256;
var g = (c.G - s) & 0xff;
var b = (c.B + s) % 256;
ImDat.setPixel(x, y, {R: r, G: g, B: b, A: c.A});
}
}
$inputJSON = file_get_contents('php://input');
$input = json_decode($inputJSON, TRUE);
$name = $input['name'];
$email = $input['email'];
$message = "Name: ".$name."\nEmail: ".$email;