Skip to content

Instantly share code, notes, and snippets.

@hh-com
hh-com / Cron_Contao4_Run_File_Without_Module.php
Created December 13, 2018 19:39
Boilerplate: Contao4- Run Singlefile without Module (by Cron)
<?php
/**
**/
define('TL_MODE', 'FE');
define('BYPASS_TOKEN_CHECK', true);
/*Cache-Control:*/
header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1
header("Pragma: no-cache"); //HTTP 1.0
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
public static function generateUniqueId()
{
# Zeichenvorrat
$zeichenvorrat = self::$zeichenvorrat;
$position = 0;
$uniqueId = '';
for ($i = 0; $i < 6; $i++)
{
$position = ($position + rand(1000, 9999)) % strlen($zeichenvorrat);
@hh-com
hh-com / generateUniqueKey.php
Last active December 13, 2018 21:51
Contao - Create a Unique Key by a char set
<?php
public static function generateUniqueId()
{
$charSet = "ABCDEFGHJKLMNPQRSTUVWXYZ123456789";
$position = 0;
$uniqueId = '';
for ($i = 0; $i < 6; $i++)
{
@hh-com
hh-com / readmore.js
Created December 17, 2018 23:35
Readmore.js for jQuery 3.*
/*!
* @preserve
*
* Readmore.js jQuery plugin
* Author: @jed_foster
* Project home: http://jedfoster.github.io/Readmore.js
* Licensed under the MIT license
*
*##############
*https://github.com/jedfoster/Readmore.js/issues/183
@hh-com
hh-com / StreamBuffer.php
Last active March 27, 2019 20:26
Workaround for Swiftmailer Easyname - Problem
// /vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
private function _establishSocketConnection()
{
$host = $this->_params['host'];
if (!empty($this->_params['protocol'])) {
$host = $this->_params['protocol'].'://'.$host;
}
$timeout = 15;
if (!empty($this->_params['timeout'])) {
@hh-com
hh-com / Browser-Sync und Contao (Windows)
Last active September 26, 2019 20:56
Browser-Sync und Contao (Windows)
1) Contao lokal installieren (WAMP)
2) vhost lokal einrichten und Windows Hosts-File
3) CMD (admin) npm installieren
4) CMD (admin) BrowserSync für das jeweilige Projekt installieren: npm install -i browser-sync
5) BrowserSync starten: browser-sync start --proxy vbeat:8080 --files **/*, !vendor/**, !/.history/**, !var/** --no-notify (proxy == vhost)
6) Verzeichniss ausschließen mit !
7) Fehlermeldung wenn zu viele Files watched werden.
INFO: Die externe IP kann falsch sein, dazu einfach mit ipconfig die IP des Systems suchen und diese mit dem Port auf externen Geräten eintragen
https://www.youtube.com/watch?v=Bxhr6OmNOJE
Helper Sheet for Contao
PHP Binary
Netcup: /usr/local/php74/bin/php -v
Hetzner: /usr/bin/php80 -v
Create a Contao installation:
/usr/local/php74/bin/php -d memory_limit=-1 -d max_execution_time=900 composer.phar create-project contao/managed-edition example 4.12
Load Contao Manager File into /web/ bzw. /public/