Skip to content

Instantly share code, notes, and snippets.

View devster's full-sized avatar

Jeremy Perret devster

View GitHub Profile
@devster
devster / ExampleTest.php
Last active May 12, 2023 20:24
OpenApi symfony testing trait
<?php
namespace Tests\Infrastructure\Action\Channel;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Tests\TestCase\OpenApiTrait;
class ExampleTest extends WebTestCase
{
use OpenApiTrait;
@devster
devster / AggregatorInterface.php
Last active March 26, 2020 14:28
Report Aggregator POC
<?php
declare(strict_types=1);
namespace App\Reporting\Core\ReportAggregator;
interface AggregatorInterface
{
/**
* @param $value int|float
@devster
devster / RetryHttpClient.php
Created January 16, 2020 11:19
Retry decorator for symfony HttpClientInterface
<?php
declare(strict_types=1);
namespace App\HttpClient;
use App\HttpClient\Response\RetryResponse;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
@devster
devster / Queue.php
Last active November 2, 2019 12:49
Heterogene iterable queue concept
<?php
namespace App\Core\Pipeline;
class Queue
{
/**
* @var \AppendIterator
*/
private $iterator;
@devster
devster / config.yml
Created February 22, 2018 12:20
How to handle null var env with symfony4
parameters:
env(SENTRY_DSN): ~
services:
sentry:
dsn: '%env(resolve:SENTRY_DSN)%' // note the resolve directive
#!/usr/bin/env bash
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
@devster
devster / release.sh
Created September 5, 2016 15:33
Relase git tag script
#!/bin/bash
# Script to simplify the release flow.
# 1) Fetch the current release version
# 2) Increase the version (major, minor, patch)
# 3) Add a new git tag
# 4) Push the tag
# Parse command line options.
while getopts ":Mmpd" Option
@devster
devster / file.io.sh
Last active February 15, 2024 17:15
Simple cli tool to use file.io https://www.file.io/#one Install: curl https://gist.githubusercontent.com/devster/e6a591879fd9c68b86c9/raw/87b826fdf20d1669fd99cbf5aa1f105e8a72a3a1/file.io.sh | sudo tee /usr/local/bin/file.io && sudo chmod +x /usr/local/bin/file.io
#!/bin/sh
URL="https://file.io"
DEFAULT_EXPIRE="14d" # Default to 14 days
if [ $# -eq 0 ]; then
echo "Usage: file.io FILE [EXPIRE]"
echo " Example: file.io path/to/my/file 1w"
echo " This example upload your file for 1 download and expires until 7 days if not downloaded."
echo "\nSee documentation at https://www.file.io/#one"
#!/bin/sh
set -e
IP=`sudo docker inspect -f '{{ .NetworkSettings.IPAddress }}' ${1}`
HOST=$2
[ -z "$HOST" ] && exit 1;
sudo sed -i "s/.*\s${HOST}$/${IP} ${HOST}/" /etc/hosts
var
path = require('path'),
_ = require('lodash'),
gulp = require('gulp'),
gulpUtil = require('gulp-util'),
log = gulpUtil.log,
colors = gulpUtil.colors,
glob = require('glob'),
fs = require('fs'),
gulpNotify = require('gulp-notify'),