Skip to content

Instantly share code, notes, and snippets.

Avatar

Charles SelrahcD

View GitHub Profile
@SelrahcD
SelrahcD / template.xml
Created June 13, 2022 08:32
Phpstorm Wither live template
View template.xml
<template name="with" value="public function with$NAME$($PARAMETER_TYPE$ $$$PARAMETER_NAME$): self&#10;{&#10;&#9;$clone = clone $this;&#10;&#9;&#10;&#9;$clone-&gt;$PARAMETER_NAME$$END$ = $$$PARAMETER_NAME$;&#10;&#9;&#10;&#9;return $clone;&#10;}" description="Create a wither" toReformat="false" toShortenFQNames="true">
<variable name="PARAMETER_TYPE" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="PARAMETER_NAME" expression="complete()" defaultValue="" alwaysStopAt="true" />
<variable name="NAME" expression="" defaultValue="capitalize(PARAMETER_NAME)" alwaysStopAt="false" />
<context>
<option name="PHP Class Member" value="true" />
</context>
</template>
@SelrahcD
SelrahcD / commits.csv
Last active October 27, 2019 21:10
Dataset
View commits.csv
date commit_count system
2015-01 110 1
2015-02 150 1
2015-03 235 1
2015-04 202 1
2015-05 270 1
2015-06 161 1
2015-07 199 1
2015-08 190 1
2015-09 246 1
@SelrahcD
SelrahcD / exceptionalEvents.php
Last active April 13, 2018 09:15
Exceptional Events
View exceptionalEvents.php
<?php
class User {
private $beers = 0;
public $id;
/**
* User constructor.
*/
public function __construct($id) {
View gist:d56f19bd832060dedad29a6ba3b842b1
Time sheet system
In my opinion we have two options :
1) The notion of time sheet is only a view concept (I want to see all entries of week #10) :
* a TrackTime command that only creates a new entry in a list and takes the (time; imputation) as parameters
* TimeSheet is a projection of the entries, here probably a subset of the list entries
2) The notion of time sheet is important in domain (I don't have an example...) :
* a TrackTime command that adds an entry for that specific time sheet and takes (timesheetId; time; imputation) as parameters
@SelrahcD
SelrahcD / TypeTest.php
Last active November 9, 2016 09:32
TypeTest.php
View TypeTest.php
<?php
class Type {
const TYPE_A = 1;
const TYPE_B = 2;
const TYPE_C = 3;
private $type;
private function __construct($type)
View bla.php
<?php
$str = "Something";
$stringValue = array_reduce(str_split($str), function($carry, $char) {
return $carry + ord($char);
}, 0);
while($stringValue > 10)
{
@SelrahcD
SelrahcD / talks.md
Last active January 15, 2018 13:04
View talks.md
View discussion.php
<?php
class Discussion
{
private $id;
private function __construct(DiscussionId $discussionId)
{
$this->id = $discussionId;
}
@SelrahcD
SelrahcD / gist:c5d4f03b61860ecb174e
Created January 22, 2015 10:00
Perf test method
View gist:c5d4f03b61860ecb174e
function test($closure, $name = null, $loop = 1000000) {
$start = microtime(true);
for($i = 0; $i < $loop; $i++) {
$closure();
}
$time = microtime(true) - $start;
if($name) {
@SelrahcD
SelrahcD / Clean Cotcot.md
Last active August 29, 2015 14:07
Clean cotcot
View Clean Cotcot.md

Nettoyage CotCot & Eve

Controllers & Templates

Liste des quotes

Controller

  • Passer sur le ListController de ev-fdm
  • Revoir le système de filtres