Skip to content

Instantly share code, notes, and snippets.

View devster's full-sized avatar

Jeremy Perret devster

View GitHub Profile
@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"
@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 / 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 / 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;
#!/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 / 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
@devster
devster / gist:7888116
Last active December 30, 2015 21:29
Trim all blank chars from a string
<?php
$str = " Hello world
";
echo trim($str, " \t\n\r\0\x0B"); // will echo "Hello World"
@devster
devster / gist:7783986
Created December 4, 2013 08:17
Transform a camel case string to an underscore string
<?php
/**
* Transform a camel case string to an underscore string
*
* @param string $str
* @return string
*/
public static function camelCaseToUnderscore($str)
{