Skip to content

Instantly share code, notes, and snippets.

View larsroettig's full-sized avatar

Lars Roettig larsroettig

View GitHub Profile
@mathiasverraes
mathiasverraes / rollyourown.php
Created May 30, 2018 14:17
We don't need no DIC libs / we don't need no deps control
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.
@ecomcoders
ecomcoders / EcomCoders.xml
Created August 7, 2017 11:41
PHPStorm Live-Templates for Magento 2 setter/getter methods
<templateSet group="EcomCoders">
<template name="m2setget" value="/**&#10;* Getter for $FIELD_UNDERSCORES$&#10;* &#10;* @return $TYPEHINT$|null&#10;*/&#10;public function get$FIELD_CAMELCASE_CAPITALIZED$()&#10;{&#10; return $this-&gt;_getData('$FIELD_UNDERSCORES$');&#10;}&#10;&#10;/**&#10;* Setter for $FIELD_UNDERSCORES$&#10;*&#10;* @param $TYPEHINT$ $$$FIELD_CAMELCASE$&#10;* @return $this&#10;*/&#10;public function set$FIELD_CAMELCASE_CAPITALIZED$($$$FIELD_CAMELCASE$)&#10;{&#10; return $this-&gt;setData('$FIELD_UNDERSCORES$', $$$FIELD_CAMELCASE$);&#10;}$END$" description="Magento2-Setter/Getter-Method" toReformat="true" toShortenFQNames="true">
<variable name="FIELD_UNDERSCORES" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="FIELD_CAMELCASE" expression="camelCase(FIELD_UNDERSCORES)" defaultValue="" alwaysStopAt="false" />
<variable name="FIELD_CAMELCASE_CAPITALIZED" expression="capitalize(camelCase(FIELD_UNDERSCORES))" defaultValue="" alwaysStopAt="false" />
<var
@eyecatchup
eyecatchup / git-commit-log-stats.md
Last active April 11, 2025 08:16
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.