Skip to content

Instantly share code, notes, and snippets.

Matthias Gutjahr mattsches

Block or report user

Report or block mattsches

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View laravel facades discussion.md

Found an example there is a thing in laravel called FormRequest. Sometimes, I need extra validation. So I need to use some service there somehow. What options I have

  1. facade
  2. service locator via app() global function
  3. I also have instance of container there via $this->container

which one is the best here? I suppose instance of container

I can't do constructor injection. Why? Because for me, it seams that there are too many arguments on the __construct method

@mattsches
mattsches / configuration.yaml
Created May 8, 2017
Beispiel für RESTful Sensor in Home Assistant zur Abfrage des luftdaten.info API
View configuration.yaml
sensor:
- platform: rest
resource: http://api.luftdaten.info/v1/sensor/1777
value_template: >
{% if value_json is sequence %}
{% set sensor = value_json | last %}
{% else %}
{% set sensor = value_json %}
{% endif %}
{% for sdv in sensor.sensordatavalues %}
View luftdatenapi.php
<?php
/**
* Class LuftdatenApi
*/
class LuftdatenApi
{
const BASE_URL = 'http://api.luftdaten.info/v1/sensor/';
/**
@mattsches
mattsches / Album.php
Created Apr 24, 2016
Example entity for DoctrineRestDriver issue
View Album.php
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* This annotation marks the class as managed entity:
*
* @ORM\Entity
@mattsches
mattsches / .filelist.txt
Created Dec 13, 2015
Liste von PHP-Dateien der Fotoverwaltung Lychee, die von Phan in dieser Reihenfolge eingelesen werden sollen.
View .filelist.txt
data/config.php
php/define.php
php/autoload.php
php/modules/Album.php
php/modules/Database.php
php/modules/Import.php
php/modules/Log.php
php/modules/Module.php
php/modules/Photo.php
php/modules/Plugins.php
@mattsches
mattsches / cors-test.html
Created Sep 20, 2015
Test page with description on how to test my pull request to the Calendar+ OwnCloud app.
View cors-test.html
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<title>OwnCloud Calendar+ CORS Test</title>
<script type="text/javascript">
var calendarICS = "###CALENDARICSURL###",
request = new XMLHttpRequest();
request.open('GET', calendarICS, true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
@mattsches
mattsches / php_functions_frequencies.json
Created Mar 15, 2015
Frequency of internal PHP functions found on GitHub
View php_functions_frequencies.json
[
{
"function":"zend_version",
"frequency":151465
},
{
"function":"func_num_args",
"frequency":779391
},
{
View keybase.md

Keybase proof

I hereby claim:

  • I am mattsches on github.
  • I am mattsches (https://keybase.io/mattsches) on keybase.
  • I have a public key whose fingerprint is F4D4 C888 055A 44C3 A5C3 33AB A8E6 AF25 C59F 4A27

To claim this, I am signing this object:

@mattsches
mattsches / fritzbox.ini
Created Nov 1, 2013
Sample Config, um mit der FRITZ!Box 7320 (Firmware-Version: 100.05.51) einen VPN-Tunnel aufzubauen. Mehr in meinem Blogpost unter http://blog.sperr-objekt.de/content/1000423-VPN-Tunnel-mit-der-FRITZ!Box-7320-und-Linux.html
View fritzbox.ini
vpncfg {
connections {
enabled = yes;
conn_type = conntype_user;
name = "MEINVPN";
always_renew = no;
reject_not_encrypted = no;
dont_filter_netbios = yes;
localip = 0.0.0.0;
local_virtualip = 0.0.0.0;
@mattsches
mattsches / layered.inc.php
Last active Dec 20, 2015 — forked from onli/layered.inc.php
Added charset to connection adapter
View layered.inc.php
<?php
use Zend\Db\Sql\Sql;
use Zend\Db\Sql\Select;
use Zend\Db\Adapter\Adapter;
$result = null;
/**
* Tells the DB Layer to start a DB transaction.
*
* @access public
You can’t perform that action at this time.