Skip to content

Instantly share code, notes, and snippets.

View clemherreman's full-sized avatar

Clement Herreman clemherreman

  • Exotec
  • Lille, France
View GitHub Profile
@clemherreman
clemherreman / CartSku.php
Created July 1, 2020 12:03
API Platform itemOperation with multiple identifiers
<?php
namespace App\Doctrine\Entity;
use ApiPlatform\Core\Action\NotFoundAction;
use ApiPlatform\Core\Action\PlaceholderAction;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Coupon\Model\OrderSkuInterface;
use App\Doctrine\Validator\Constraints\CartSkuLoyalty;
@clemherreman
clemherreman / CreditNote.php
Created February 20, 2020 16:31
APIP single table inheritance
<?php
/**
* @ORM\Entity
*
* @ApiResource(
* normalizationContext={"groups"={"creditNote:read"}},
* collectionOperations={
* "get"={"controller"=NotFoundAction::class}
* },
* itemOperations={
https://www.codingame.com/evaluate/?target=clogin&id=2794381f2ab72d52aa23b4546f45454a7d533f2
@clemherreman
clemherreman / docker-https.md
Created January 22, 2018 10:39 — forked from zalexki/docker-https.md
Docker Apache2.4 HTTPS

Open port 443 on container, with a docker-compose file just add :

ports:
  - 443:443

Add virtualhost config :

Listen 443 https
  
@clemherreman
clemherreman / config.yml
Last active June 19, 2017 21:18
Yan hanging on Circle20 :(
version: 2
jobs:
build:
docker:
- image: clemherreman/aif-ci:0.0.2
- image: mysql:5.6
environment:
MYSQL_ROOT_PASSWORD: root
@clemherreman
clemherreman / php -v
Created May 20, 2015 13:29
Blackfire Probe troubleshoot
[vagrant@luceo-ocb vagrant]$ php -v
PHP 5.4.41 (cli) (built: May 14 2015 23:37:34)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
@clemherreman
clemherreman / main.go
Created January 28, 2015 12:30
Go casting byte to string
package main
import "fmt"
type IPAddr [4]byte
func (i IPAddr) String() string {
return string(i[0]) // Returns an empty string
return fmt.Sprintf("%v.%v.%v.%v", i[0], i[1], i[2], i[3]) // Only way to cast byte to string is through Sprintf
}
<?php
class FailTest extends \PHPUnit_Framework_TestCase
{
public function testfail()
{
fail();
$this->assertTrue(true);
}
}
class MyService {
private $finderFactory;
public function __construct(callable $finderFactory)
{
$this->finderFactory = $finderFactory;
}
public function findStuff()
{
@clemherreman
clemherreman / shortcut.js
Created October 9, 2014 14:58
Joseph's productivity x1000 multiplier
// Step 1: include jQuery
var jq = document.createElement('script');
jq.src = "//code.jquery.com/jquery-latest.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
// Step 2: create a textarea
jQuery('#console').after('<textarea id="filenames"></textarea>');