This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Contact Form 7 Spam Filter | |
*/ | |
add_filter( 'wpcf7_spam', function( $spam ) { | |
if ( $spam ) | |
return $spam; | |
$spam_key_words = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Coming Soon</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main idea from https://www.youtube.com/watch?v=PNjNFatebgY&lc=UgzPj8mKHXk4akXfLcR4AaABAg | |
function getTomorrow( date = Date.now() ) { | |
let today = new Date(date); | |
let tomorrow = today.setDate(today.getDate() + 1); | |
return tomorrow; | |
} | |
function formatDate( date ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"better-comments.tags": [ | |
{ | |
"tag": "!", | |
"color": "#bf616a" | |
}, | |
{ | |
"tag": "?", | |
"color": "#81a1c1" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param string $date - [YYYY-MM-DD] | |
* @return int | |
*/ | |
function getWeekday( string $date ):int { | |
// 'w' 0 (for Sunday) through 6 (for Saturday) | |
$result = (int) date('w', strtotime($date)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* convert string (hash) to object | |
* @param {string} hash | |
* @returns {object} | |
*/ | |
function hashToObject(hash) { | |
let obj = {}; | |
hash = hash.slice(1); | |
let params = hash.split(','); | |
params.forEach(param => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$chars = ''; | |
// 65 - 122 (A-Za-z) | |
// 48 - 122 (0-9A-Za-z) | |
for ($i = 48; $i <= 122; $i++) { | |
// skip 58 - 64 and 91 - 96 | |
if ($i >= 58 && $i <= 64 || $i >= 91 && $i <= 96) | |
continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* source: https://rosettacode.org/wiki/Vigen%C3%A8re_cipher#JavaScript | |
*/ | |
// vigenere | |
function vigenere(text, key, decode) { | |
// helper | |
const ordA = a => a.charCodeAt(0) - 65; | |
// main | |
let i = 0, b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns a boolean if the element contains that property | |
const hasCssProperty = (elmt, property) => { | |
const elmtPropertyValue = window.getComputedStyle(elmt, null).getPropertyValue(property); | |
return elmtPropertyValue ? true : false; | |
} | |
// live example | |
const elmt = document.querySelector('#video'); | |
if (hasCssProperty(elmt, 'aspect-ratio')) { |