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 () { | |
function addStyleSheet() { | |
var e = document.createElement("link"); | |
e.setAttribute("type", "text/css"); | |
e.setAttribute("rel", "stylesheet"); | |
e.setAttribute("href", styleSrc); | |
e.setAttribute("class", markerClass); | |
document.body.appendChild(e) | |
} |
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
/** | |
* unitConv - converts length, weight, area and volume units | |
* | |
* Usage: unitConv.type(value, unitIn, unitOut) | |
* type: length | weight | area | volume | |
* v: numeric value | |
* unitIn: name of the input unit | |
* unitOut: name of the output unit | |
* | |
* Supported units: |
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 utf8_hex(str) { | |
return Array.from(str).map(c => | |
c.charCodeAt(0) < 128 ? c.charCodeAt(0).toString(16).padStart(2, '0') : | |
encodeURIComponent(c).replace(/\%/g,'').toLowerCase() | |
).join(''); | |
} | |
function hex_utf8(hex) { | |
return decodeURIComponent('%' + hex.match(/.{1,2}/g).join('%')); | |
} |
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
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. | |
Лорем ипсум долор сит амет, пер цлита поссит ех, ат мунере фабулас петентиум сит. Иус цу цибо саперет сцрипсерит, нец виси муциус лабитур ид. Ет хис нонумес нолуиссе дигниссим. | |
Λορεμ ιπσθμ δολορ σιτ αμετ, μει ιδ νοvθμ φαβελλασ πετεντιθμ vελ νε, ατ νισλ σονετ οπορτερε εθμ. Αλιι δοcτθσ μει ιδ, νο αθτεμ αθδιρε ιντερεσσετ μελ, δοcενδι cομμθνε οπορτεατ τε cθμ. | |
側経意責家方家閉討店暖育田庁載社転線宇。得君新術治温抗添代話考振投員殴大闘北裁。品間識部案代学凰処済準世一戸刻法分。悼測済諏計飯利安凶断理資沢同岩面文認革。内警格化再薬方久化体教御決数詭芸得筆代。 | |
旅ロ京青利セムレ弱改フヨス波府かばぼ意送でぼ調掲察たス日西重ケアナ住橋ユムミク順待ふかんぼ人奨貯鏡すびそ。 |
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
/** | |
* Super simple encryption utilities | |
* Inspired by https://gist.github.com/sukima/5613286 | |
* Properly handles UTF-8 strings | |
* Use these functions at your own risk: xor encryption provides only acceptable | |
* security when the key is random and longer than the message | |
* If looking for more reliable security use: https://tweetnacl.js.org/ | |
* | |
* Use passwordDerivedKey function in this file to generate a key from a password, or to generate a random key | |
*/ |
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 creditCardValidator(cc) { | |
/** | |
* Credit card validator | |
* Based on: https://www.freeformatter.com/credit-card-number-generator-validator.html | |
* and this: https://en.wikipedia.org/wiki/Payment_card_number | |
*/ | |
// Remove all non-numeric characters | |
cc = cc.toString().replace(/\D/g,''); |
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
# Redirect domain and force SSL # | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^example.com$ [OR,NC] | |
RewriteCond %{SERVER_PORT} 80 | |
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] | |
<If "%{HTTPS} == 'on'"> | |
# Password Protect Directory # | |
AuthUserFile /srv/www/example.com/.htpasswd | |
AuthName "Enter username and password" |
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
#!/bin/bash | |
# Check if script is being run by root | |
if [[ $EUID -ne 0 ]]; then | |
printf "This script must be run as root!\n" | |
exit 1 | |
fi | |
DIVIDER="\n***************************************\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
<?php | |
// JPEG quality level | |
$quality = 85; | |
// Recursively scan directory and get jpeg images | |
$sourceDir = __DIR__ . '/original'; | |
$targetDir = __DIR__ . '/optimized'; | |
function getFiles($dir) { | |
if(is_dir($dir)) { |
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
var baseFonts = ['monospace', 'sans-serif', 'serif']; | |
var testChars = ['M', 'g', 'l', 'i', 'ff', 'fi']; | |
var b = document.getElementsByTagName('body')[0]; | |
var s = document.createElement('span'); | |
s.style.position = 'absolute'; | |
s.style.left = '-9999px'; | |
s.style.fontSize = '100px'; |
NewerOlder