Skip to content

Instantly share code, notes, and snippets.

View japaveh's full-sized avatar

Johan van der Heide japaveh

View GitHub Profile
<?php
declare(strict_types=1);
namespace Accounting\Controller;
use Accounting\Adapter\TwinfieldAdapter;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Session\Container;
use Laminas\View\Model\ViewModel;
@japaveh
japaveh / TwinfieldAdapter.php
Created December 10, 2021 12:48
Class to fetch tokens using Twinfield
<?php
declare(strict_types=1);
namespace Accounting\Adapter;
use Accounting\Options\ModuleOptions;
use Contact\Service\ContactService;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
@japaveh
japaveh / UpdateProject.php
Created March 25, 2021 15:41
Update Project via Guzzle in reporting Portal
<?php
/**
* ITEA Office all rights reserved
*
* @author Johan van der Heide <johan.van.der.heide@itea3.org>
* @copyright Copyright (c) 2021 ITEA Office (https://itea3.org)
* @license https://itea3.org/license.txt proprietary
*/
namespace Cluster\Command;
@japaveh
japaveh / ProjectListener.php
Last active April 12, 2021 14:48
ProjectListener code to import projects from JSON
<?php
/**
* ITEA Office all rights reserved
*
* @author Johan van der Heide <johan.van.der.heide@itea3.org>
* @copyright Copyright (c) 2021 ITEA Office (https://itea3.org)
* @license https://itea3.org/license.txt proprietary
*/
namespace Api\V1\Rest\UpdateResource;
@japaveh
japaveh / gist:614efa22bab263ec8538
Created February 18, 2016 08:40
Validator for callback which is also triggered for an empty value
'deeplinkTarget' => [
'validators' => [
[
'name' => 'NotEmpty',
'options' => [
'type' => NotEmpty::NULL
]
],
[
@japaveh
japaveh / gist:fb9172b6c1005aaf987e
Created December 5, 2015 15:28
php7-nginx-configuration
server {
listen 80;
server_name php7.jield.net;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
<?php
return [
'zfctwig' => [
'environment_options' => [
'cache' => null
]
],
];
@japaveh
japaveh / doIdealTransaction.php
Created August 9, 2013 22:27
ZF2 service file towards slmIdeal
<?php
/**
* Japaveh Webdesign copyright message placeholder
*
* @category Order
* @package Controller
* @subpackage Plugin
* @author Johan van der Heide <info@japaveh.nl>
* @copyright Copyright (c) 2004-2013 Japaveh Webdesign (http://japaveh.nl)
*/
@japaveh
japaveh / pre-commit
Created August 5, 2013 08:07
Git-pre-commit-hook Link checker
#!/C/xampp/php/php
<?php
#!/usr/bin/env php
/**
* Git pre-commit hook to run php lint.
*
* Git hooks on Windows: Ensure that the path to PHP is added to the %PATH% variable, and run `git commit` via the Bash shell.
*
* @copyright 2012-04-30 N.D.Freear.
* @license MIT
@japaveh
japaveh / show_swap_consumption
Created August 2, 2013 19:27
Script to find the applications consuming swap memory
#!/bin/bash
# Get current swap usage for all running processes
# Erik Ljungstrom 27/05/2011
# Modified by Mikko Rantalainen 2012-08-09
# Pipe the output to "sort -nk3" to get sorted output
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"`
do
PID=`echo $DIR | cut -d / -f 3`