I hereby claim:
- I am devnix on github.
- I am devnix (https://keybase.io/devnix) on keybase.
- I have a public key whose fingerprint is F533 CBB2 E009 31F8 DC9F CDB9 C366 D0EA 569E D236
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
<?php | |
function flattenExceptionBacktrace(\Exception $exception) { | |
$traceProperty = (new \ReflectionClass('Exception'))->getProperty('trace'); | |
$traceProperty->setAccessible(true); | |
$flatten = function(&$value, $key) { | |
if ($value instanceof \Closure) { | |
$closureReflection = new \ReflectionFunction($value); | |
$value = sprintf( | |
'(Closure at %s:%s)', |
<?php | |
declare(strict_types=1); | |
namespace Shared\Domain\DependencyInjection; | |
interface ContainerInterface | |
{ | |
/** | |
* @return object|null |
I had an interesting use-case with a customer for which I provide consulting services: they needed multiple fields to be marked as "optional".
We will take a CRUD-ish example, for the sake of simplicity.
For example, in the following scenario, does a null
$description
mean "remove the description",
{# | |
Parameters: | |
* total (int): number of pages | |
* current (int): current pages | |
* url (string): route name & query (string): route parameter | |
ex: list/page-5?q=myFilter (5 = page and query = myFilter) | |
* nearbyPagesLimit (int) optional: limit of pages around the current page | |
#} | |
{% macro pagination(total, current, url, nearbyPagesLimit = 4) %} |
(function() { | |
'use strict' | |
// Constructor | |
function Common() { | |
// Example of calling to a private method from the constructor | |
_foo(); | |
} |
/** | |
* @constructor | |
*/ | |
function OptimizedEvent() { | |
this.callbacks = []; | |
this.running = false; | |
} | |
<?php | |
// Prestashop's root folder, in my example Prestashop is installed in the root folder, and Wordpress is installed in /blog | |
define('PRESTASHOP_ROOT', ABSPATH.'..'); | |
// Still don't know if necessary | |
// require PRESTASHOP_ROOT.'/config/settings.inc.php'; | |
// require PRESTASHOP_ROOT.'/config/defines.inc.php'; |
<?php | |
function color_meter($cwith, $ccolor) { | |
if (empty($cwith) || empty($ccolor)) return false; | |
$_cwith = ($cwith[0] === '#') ? substr($cwith, 1, 7) : $cwith; | |
$_ccolor = ($ccolor[0] === '#') ? substr($ccolor, 1, 7) : $ccolor; | |
$_r = intval(substr($_cwith, 0, 2), 16); | |
$_g = intval(substr($_cwith, 2, 2), 16); |
(function() { | |
'use strict'; | |
// Your code | |
})(); |