Skip to content

Instantly share code, notes, and snippets.

@jpomykala
jpomykala / synology-mysql-backup.sh
Last active November 10, 2019 13:32
mysql-backup.sh
#!/bin/bash
# I installed MariaDB 10 from Package Center
export PATH=/bin:/usr/bin:/usr/local/bin:/volume1/@appstore/MariaDB10/usr/local/mariadb10/bin
# Put backups in the same place where the script is placed
DB_BACKUP_PATH=`dirname "$0"`
backup-mysql() {
MYSQL_HOST=$1
@jpomykala
jpomykala / example.po
Created April 1, 2021 14:51
A simple example of a PO file
msgid ""
msgstr ""
"Project-Id-Version: SimpleLocalize 1.0\n"
"Report-Msgid-Bugs-To: [email protected] \n"
"Last-Translator: Jakub Pomykała <[email protected]>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
@jpomykala
jpomykala / detectBrowserLocale.ts
Last active April 13, 2021 11:04
Detecting browser locale for SimpleLocalize.io
export const LOCALE_PATTERN = /[a-z]{2}_[A-Z]{2}/gi;
export const isLocaleValid = (locale: string): boolean => {
return Boolean(new RegExp(LOCALE_PATTERN).test(locale));
}
export const getBrowserLocaleOrNull = (): string | null => {
const locale = window.navigator.language; //won't work on SSR
import axios from 'axios';
import { faker } from '@faker-js/faker';
async function sendRequest() {
const data = {
template: 'TEMPLATE',
data: {
'title.text': faker.lorem.sentence()
}
};