Skip to content

Instantly share code, notes, and snippets.

Avatar

Georgian Tomescu georgeasd

  • Expert Vision
  • Targoviste, Dambovita
View GitHub Profile
@georgeasd
georgeasd / Filterable.php
Created Jan 15, 2018 — forked from Alymosul/Filterable.php
Abstract Layer for Query Filters in Laravel
View Filterable.php
<?php
namespace App\Filters\Query;
trait Filterable
{
/**
* Apply Filters on the Eloquent Model
*
* @param $query
View ddd_cqrs_event-sourcing_in_php.md

DDD, CQRS and Event Sourcing in PHP

  • Broadway - Infrastructure and testing helpers for creating CQRS and event sourced applications
  • EventCentric.Core - Event Sourcing and CQRS in PHP
  • LiteCQRS - Small convention based CQRS library for PHP
  • predaddy - Common DDD classes including an annotation driven message bus and tools for CQRS and Event Sourcing
  • ProophEventSourcing - Provides basic functionality for event-sourced aggregates
  • ProophEventStore - PHP 5.4+ EventStore Implementation
  • ProophServiceBus - PHP Enterprise Service Bus Implementation supporting CQRS and DDD
@georgeasd
georgeasd / curl.md
Created May 3, 2017 — forked from subfuzion/curl.md
curl POST examples
View curl.md

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

View gist:2c7cc4cdce0a1569d1ebcc73766b0bc9
There are a lot of complaints going around about Laravel these days, but a lot
of the important ones seem to be missing from the spotlight.
Bugfixes, issues and pull requests being left open for months with no
clarification of intent:
- https://github.com/laravel/framework/pull/1799
- https://github.com/laravel/framework/issues/1963
- https://github.com/laravel/framework/issues/2089
- https://github.com/laravel/framework/issues/2234
@georgeasd
georgeasd / less-bem.less
Created Oct 24, 2016 — forked from adamwathan/less-bem.less
BEM-ish nesting in Less
View less-bem.less
.episode {
margin-bottom: 5em;
&-header {
&-title {
margin-top: 0;
margin-bottom: (@line-height-computed / 4);
font-size: @font-size-h4;
}
&-meta {
margin-top: 0;
@georgeasd
georgeasd / laravel-cors.php
Created Oct 24, 2016 — forked from adamwathan/laravel-cors.php
Need to do something like this to serve APIs that are going to be consumed by JS clients.
View laravel-cors.php
<?php
App::before(function($request) {
if ($request->getMethod() == 'OPTIONS') {
$response = Response::make('', 204);
$response->header('Access-Control-Allow-Methods', 'GET, POST, PUT, OPTIONS');
$response->header('Access-Control-Allow-Origin', '*');
$response->header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
return $response;
}
@georgeasd
georgeasd / struct.php
Created Oct 24, 2016 — forked from adamwathan/struct.php
Structs in PHP
View struct.php
<?php
// Wow this whole thing is horrible
class Struct
{
public function __construct($properties)
{
foreach ($properties as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
View Marge.php
<?php
namespace App\Merge;
class Marge
{
protected $data = [];
public function setData($data)
{
@georgeasd
georgeasd / maxBy.php
Created Oct 24, 2016 — forked from adamwathan/maxBy.php
maxBy/minBy macros
View maxBy.php
<?php
Collection::macro('maxBy', function ($callback) {
$callback = $this->valueRetriever($callback);
return $this->reduce(function ($result, $item) use ($callback) {
if ($result === null) {
return $item;
}
return $callback($item) > $callback($result) ? $item : $result;
@georgeasd
georgeasd / latency.markdown
Created Oct 11, 2016 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs