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
function main() { | |
console.info('Page ready...'); | |
} | |
if (document.readyState === 'complete') { | |
main(); | |
} else { | |
window.addEventListener('load', function() { | |
main(); | |
}); |
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_env.c> | |
SetEnv CONTEXT Development | |
</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
/** | |
* Create a simple ID with JavaScript. | |
* | |
* @author Tobias Röder | |
* @version 1.0.0 | |
* | |
* @param {Number} length | |
* | |
* @returns {String} | |
*/ |
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 | |
/** | |
* Get the average color from an JPEG image. | |
* | |
* @param string $image_path Explicit path to the image. | |
* | |
* @return string Returns a HEX value. | |
*/ | |
function average_color(string $image_path): string |
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
/** | |
* Store data as an single item in the local storage. | |
* | |
* @author Tobias Röder | |
* @version 1.0.0 | |
* | |
* @property reck | |
* @property itemName | |
* | |
* @method init |
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 | |
/** | |
* PseudoCrypt by KevBurns (http://blog.kevburnsjr.com/php-unique-hash) | |
* Reference/source: https://stackoverflow.com/a/1464155/933782 | |
* | |
* @author KevBurns | |
* @link https://web.archive.org/web/20130727034425/http://blog.kevburnsjr.com/php-unique-hash | |
*/ |
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
Show hidden characters
// Default Tags | |
{ | |
"color": "#c8342a", | |
"tag": "!" | |
}, | |
{ | |
"color": "#3c63a6", | |
"tag": "?" | |
}, | |
{ |
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
/** | |
* Custom date format prototype. | |
* | |
* @param {string} format Format character inspired by PHP. @link https://www.php.net/manual/en/datetime.format.php | |
* | |
* @returns {string|Date} | |
*/ | |
Date.prototype.format = function (format) { | |
const to2digits = n => (n < 10 ? '0' + n : n); |
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
/** | |
* Turn a one digit number into a two digit number string. | |
* | |
* If you can not garantee that the number n is a number, simply wrap it with Number(n) to turn the string into a number. | |
* | |
* The following three functions are doing the same thing. You can choose which one fits the best purpose for you. The last one has the most legacy support. | |
*/ | |
/** | |
* Turn a one digit number into a two digit number string by using the padStart method. |
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
class Advent { | |
#oneDayMs = 86400000; | |
constructor(year = new Date().getFullYear()) { | |
this.christmasEve = `${year}-12-24`; | |
this.christmasEveDate = new Date(this.christmasEve); | |
} | |
#getDiff(days) { | |
return this.christmasEveDate.getDay() + days; |
NewerOlder