Skip to content

Instantly share code, notes, and snippets.

View lunetics's full-sized avatar

Matthias Breddin lunetics

View GitHub Profile
<?php
declare(strict_types=1);
class Bar
{
public function getStuff() : int
{
return 1;
}
<?php
function Loose(?array $foo) : ?array
{
$localScoped = null;
if ($foo !== null) {
foreach ($foo as $bar) {
$localScoped[] = $bar->stuff();
}
}
<?php
interface Price
{
public function money(): Money;
public function currency(): Currency;
}
class Vat
<?php
namespace AppBundle\Form\Type
use AppBundle\Form\DataTransformer\ContactPersonLanguageModelTransformer;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class AcmeType extends AbstractType
access.format = "[%{%Y-%m-%dT%H:%M:%S%z}t] requestid:%{REQUEST_ID}e frontendip:%R frontendhost:%{SERVER_HOSTNAME}e host:%{HTTP_HOST}e clientip:%{REAL_IP}e https:%{HTTPS}e verb:%m response:%s fpm_pool:%n request:\"%{REQUEST_URI}e%Q%q\" script_filename:%f php_process_time:%{micro}d php_process_bytes:%{bytes}M php_cpu_user:%{user}C%% php_cpu_system:%{system}C%% php_cpu_total:%{total}C%%"
#!/usr/bin/env bash
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
<?php
namespace Lunetics\AppBundle\Form\Response;
class FormInterceptor {
public function getFormErrorsToJson(Form $form)
{
$errors = array();
$translator = $this->get('translator');
<?php
$var= "123_456";
$intval = intval($var);
$trim = trim($var);
var_dump($intval); // returns int(123)
var_dump($trim); // returns "123_456"
var_dump($intval == $trim); // true or false?
#!/bin/sh
if ! [ -z "$*" ];
then
separator="|";
regex="$( printf "%s${separator}" "${@}" )";
filter="-f \"${regex%?}\""
fi;
echo ${filter};
/usr/local/bin/sudo gstat -b -I 1s ${filter} | sed '1,2d' | awk -v host=${COLLECTD_HOSTNAME:=`hostname -f`} -v interval=${COLLECTD_INTERVAL:-10} '{
print "PUTVAL " host "/iostat-" $10 "/iostat_tql" " interval=" interval " N:" $1;
regexp=[\d]{4}-[\d]{2}-[\d]{2} [\d]{2}:[\d]{2}\:[\d]{2}
colours=green
======
regexp=[\w\d]+\.[\w\d]+:
colours=green bold
======
regexp="[\w\d]+\.[\w\d+]+"
colours=on_green
======
regexp= "[\w\d:\\ ]+"\.