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
type ErrorOrResult<TError, TResult> = [TError, undefined?] | [null, TResult]; | |
/** | |
* Wraps a function or promise in a try-catch block and returns a tuple with an error or the result | |
* | |
* @example | |
* // async | |
* const [error, response] = await tryCatch(fetch('https://example.com')); | |
* if (error) { | |
* console.error(error.message); |
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
$(document).on("dragover drop", function (e) { | |
e.preventDefault(); | |
}); | |
$(".filestorage div.storage").on("dragover drop", function (e) { | |
e.preventDefault(); | |
}).on('dragover dragenter', function() { | |
$(this).addClass('is-dragover'); | |
}).on('dragleave dragend drop', function() { | |
$(this).removeClass('is-dragover'); |
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 | |
# exit when any command fails | |
set -e | |
COLOR_GREEN="\033[0;32m" | |
DEVELOPER=$(whoami) | |
cd "/var/www/$DEVELOPER.tmp123.cz/web/" | |
clear |
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 | |
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
file=$1 | |
publickey=$dir/backup-key-public.pem | |
if [ ! -f "$publickey" ]; then | |
echo "Public key $publickey not found." | |
exit | |
fi | |
if [ -f "$file" ]; then | |
dirkey=$(openssl rand -hex 16) |
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
FOR /F "tokens=*" %%i IN (' dir /b /A %HOMEPATH%\.PhpStorm* ') DO SET PHPSTORM_DIR=%HOMEPATH%\%%i | |
cd %PHPSTORM_DIR% | |
del config\options\other.xml | |
del config\eval\*.evaluation.key | |
reg delete "HKEY_CURRENT_USER\SOFTWARE\JavaSoft\Prefs\jetbrains\phpstorm" /f | |
FOR /F "tokens=*" %%i IN (' dir /b /A %APPDATA%\JetBrains\PhpStorm* ') DO SET PHPSTORM_DIR=%APPDATA%\JetBrains\%%i | |
cd %PHPSTORM_DIR% | |
del options\other.xml | |
del eval\*.evaluation.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
#!/bin/bash | |
echo -e "===== BACKUP DECRYPTOR ==================================" | |
echo "" | |
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
file=$1 | |
argkey=$2 | |
privatekey=$dir/backup-key-private.pem | |
if [ ! -f "$privatekey" ]; then | |
echo " Private key $privatekey not found!" | |
else |