Skip to content

Instantly share code, notes, and snippets.

Working hard!

Dominik Procházka Domm98CZ

Working hard!
View GitHub Profile
View CurlService.php
<?php declare(strict_types=1);
namespace CurlService;
use RuntimeException;
* Class CurlService
* @package CurlService
class CurlService
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 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 @tables = NULL;
SELECT GROUP_CONCAT('`', table_schema, '`.`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables, '') INTO @tables;
Domm98CZ / phpRandomBasedOnTime.php
Created Oct 28, 2019
Random login screen images, based on time.
View phpRandomBasedOnTime.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
namespace App;
use Nette;
use Tracy\Debugger;
use App\Model;
use Nette\Neon\Neon;
class Translator implements Nette\Localization\ITranslator