Skip to content

Instantly share code, notes, and snippets.

View mentisy's full-sized avatar

Alexander Volle mentisy

View GitHub Profile
@mentisy
mentisy / Cell.php
Created March 21, 2023 23:59
Eksempler på OOP i PHP for å sammenligne med Cue Visual Basic
<?php
declare(strict_types=1);
namespace App;
/**
* Cell class
*
* Abstract class for inheritance
*/
@mentisy
mentisy / Cue.vb
Last active March 21, 2023 23:55
Example of commented code
///////////////////////////////////////
// Change state of water for toilet
//
// Parameter `State`:
// - 0: Open
// - 1: Close
// - 2: Toggle? Or reverify state?
///////////////////////////////////////
Global Function SetWaterWC (State As Long)
WaterProcesBusy[2].Lock()
@mentisy
mentisy / Application.php
Created December 27, 2022 23:03
Plugins panel for CakePHP's plugin DebugKit
<?php
// bootstrap in Application.php
Configure::write('DebugKit.panels', ['plugins']);
@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>
@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 / 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 / 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 / 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 / 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 / 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"