Skip to content

Instantly share code, notes, and snippets.

Avatar
🎮
Working hard!

Dominik Procházka Domm98CZ

🎮
Working hard!
View GitHub Profile
@Domm98CZ
Domm98CZ / randomCzechNameBySeed.php
Last active Apr 12, 2021
Náhodné české jméno založené na seedu
View randomCzechNameBySeed.php
<?php
declare(strict_types=1);
class xyz
{
/**
* @param string $seed
* @return string
*/
@Domm98CZ
Domm98CZ / .htaccess
Created Mar 21, 2021
wedos domain htaccess
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{SERVER_NAME} [L,R=301]
</IfModule>
@Domm98CZ
Domm98CZ / .htaccess
Last active Mar 21, 2021
wedos main htaccess
View .htaccess
RewriteEngine On
ErrorDocument 500 "500 - Vnitrni chyba!"
ErrorDocument 404 "404 - Stranka nenalezena!"
ErrorDocument 401 "Litujeme, ale nemate pravo k pristupu k tomuto souboru!"
ErrorDocument 403 "Litujeme, ale nemate pravo k pristupu k tomuto souboru!"
# cele domeny (aliasy)
RewriteCond %{REQUEST_URI} !^domains/
RewriteCond %{REQUEST_URI} !^/domains/
View CurlService.php
<?php declare(strict_types=1);
namespace CurlService;
use RuntimeException;
/**
* Class CurlService
* @package CurlService
*/
class CurlService
@Domm98CZ
Domm98CZ / misc.xml
Created Feb 8, 2020
PHPStorm Nette ignore list
View misc.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="PhpEntryPointsManager">
<pattern value="\*\Presenters\*" member="createComponent*" />
<pattern value="\*\Presenters\*" member="handle*" />
<pattern value="\*\Presenters\*" member="action*" />
<pattern value="\*\Presenters\*" member="render*" />
View dropDatabase.sql
use `dbName`; --your db name here
SET FOREIGN_KEY_CHECKS = 0;
SET @tables = NULL;
SET GROUP_CONCAT_MAX_LEN=32768;
SELECT GROUP_CONCAT('`', table_schema, '`.`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables, '') INTO @tables;
@Domm98CZ
Domm98CZ / phpRandomBasedOnTime.php
Created Oct 28, 2019
Random login screen images, based on time.
View phpRandomBasedOnTime.php
<?php
$loginImages = ['login-bg-11.jpg', 'login-bg-12.jpg', 'login-bg-13.jpg', 'login-bg-14.jpg', 'login-bg-15.jpg', 'login-bg-16.jpg', 'login-bg-17.jpg'];
$seed = srand(floor(time() / (60*60*24)));
$randomizedSeedNumber = rand(0, count($loginImages)) % 100;
$randomizedLoginImage = $loginImages[$randomizedSeedNumber]??$loginImages[0];
echo $randomizedLoginImage;
?>
View translator.php
<?php
namespace App;
use Nette;
use Tracy\Debugger;
use App\Model;
use Nette\Neon\Neon;
class Translator implements Nette\Localization\ITranslator
{