Skip to content

Instantly share code, notes, and snippets.

View mentisy's full-sized avatar

Alexander Volle mentisy

View GitHub Profile
<?php
namespace App\Command;
use Cake\Console\Arguments;
use Cake\Console\Command;
use Cake\Console\ConsoleIo;
/**
* Hello command.
*/
<?php
namespace App\Shell;
use App\Mailer\ToolsStatusMailer;
use App\Model\Entity\User;
use App\Model\Table\ToolsStatusTable;
use App\Model\Table\UsersTable;
use Cake\Console\Shell;
@mentisy
mentisy / templates.php
Last active March 2, 2019 16:18
KNX Configurator Templates
<?php
namespace Avolle\Knx\Types;
use Avolle\Knx\Generate;
class House extends Generate {
/**
* Template to base on adding main groups, middle groups and addresses
*
@mentisy
mentisy / templates.pot
Last active March 2, 2019 18:55
KNX Configurator Templates translations
# Copyright 2018 <knx@avolle.com>
#
msgid ""
msgstr ""
"Project-Id-Version: 0.5\n"
"POT-Creation-Date: 2018-08-04 20:52+0200\n"
"Language-Team: Norwegian <knx@avolle.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@mentisy
mentisy / EntitiesTrait.php
Created July 15, 2019 16:33
CakePHP: Trait for outputting entities in CLI
<?php
namespace App\Command\Traits;
use Cake\Console\ConsoleIo;
use Cake\Datasource\EntityInterface;
trait EntitiesTrait {
/**
@mentisy
mentisy / ErrorHelper.php
Created July 15, 2019 16:34
CakePHP: Output entity errors in CLI
<?php
namespace App\Command\Helper;
use Cake\Console\Helper;
class ErrorHelper extends Helper {
/**
* @param array $args
@mentisy
mentisy / TestCommand.php
Last active April 17, 2020 16:46
This gist is a reconstruction of a failing test in CakePHP version 4.0.5. This test passes in 4.0.4
<?php
declare(strict_types=1);
namespace App\Command;
use Cake\Console\Arguments;
use Cake\Command\Command;
use Cake\Console\ConsoleIo;
/**
@mentisy
mentisy / DeleteMemberCommandTest.php
Created February 7, 2021 15:30
Mocking tables integration test
<?php
declare(strict_types=1);
namespace App\Test\TestCase\Command;
use Cake\TestSuite\ConsoleIntegrationTestTrait;
use Cake\TestSuite\TestCase;
/**
* App\Command\DeleteMemberCommand Test Case
@mentisy
mentisy / maxmator.lua
Last active January 13, 2022 06:52
Kalkulerer VAV-pådrag basert på status lys og kjølepådrag
local LIGHT_STATUS = '32' -- Hovedgruppeadresse for Lys Status
local COOLING = '33' -- Hovedgruppeadresse for Kjølepådrag fra Termostat
local VAV = '34' -- Hovedgruppeadresse for VAVpådrag som sendes til VAV
local LEVEL_STANDBY = 30 -- Lys AV og Kjølepådrag AV
local LEVEL_LIGHT = 60 -- Lys PÅ og Kjølepådrag AV
-------------------------------------------------------------------------------------------
-------------------------------------- END CONSTANTS --------------------------------------
-------------------------------------------------------------------------------------------
@mentisy
mentisy / .htaccess-react-attendance
Created June 15, 2022 01:20
React app in CakePHP project
# React root /webroot/attendance
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [L]
</IfModule>