Skip to content

Instantly share code, notes, and snippets.

View mov2mp4
#!/bin/sh
BASENAME=$(basename $1)
ffmpeg -i $1 -s hd480 -c:v libx264 -crf 22 -c:a libfdk_aac -vsync passthrough ${BASENAME%.*}.mp4
@andybeak
andybeak / Dockerfile
Created Sep 4, 2020
Include xdebug in Dockerfile
View Dockerfile
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_host = host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.
View BaseEnum.php
<?php
declare(strict_types=1);
namespace App\Common\Enum;
use ReflectionException;
use ReflectionClass;
use InvalidArgumentException;
View BaseEnum.php
<?php
declare(strict_types=1);
namespace App\Common\Enum;
use ReflectionException;
use ReflectionClass;
use InvalidArgumentException;
@andybeak
andybeak / TestBase.php
Created Jun 1, 2020
An attempt to try and test CodeIgnitor library
View TestBase.php
<?php
namespace Test;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use ReflectionException;
class TestBase extends TestCase
{
@andybeak
andybeak / recreate_database.sh
Created May 13, 2020
Symfony recreate database
View recreate_database.sh
#!/bin/bash
echo "-----------------------------------------------------------------------------------------------"
echo " 💣This command will move your Migration PHP files to /tmp, drop the database, and recreate it"
echo "-----------------------------------------------------------------------------------------------"
read -r -p "Are you sure you want to do this? [y/N] " response
echo ""
if [[ "$response" =~ ^[Yy]$ ]]
then
mv ../src/Migrations/*.php /tmp
../bin/console doctrine:database:drop --force
@andybeak
andybeak / ExampleTest.php
Last active Feb 24, 2020
Test protected and private methods in PHPUnit
View ExampleTest.php
// -----------------------------------------------------------------------------------------------------------------
protected function getMethod($methodName, $object)
{
try {
$class = new \ReflectionClass(get_class($object));
$method = $class->getMethod($methodName);
$method->setAccessible(true);
return $method;
} catch (\ReflectionException $e) {
@andybeak
andybeak / create_certs_for_mysql.sh
Last active Dec 12, 2019
Create MySQL certificates
View create_certs_for_mysql.sh
#!/bin/bash
# https://dev.mysql.com/doc/refman/5.7/en/creating-ssl-files-using-openssl.html
# Create clean environment
rm -rf newcerts
mkdir newcerts && cd newcerts
# Create CA certificate
# Use default values for everything except common name
openssl genrsa 2048 > ca-key.pem
@andybeak
andybeak / Dockerfile
Created Dec 4, 2019
Lab 4 - Laravel in ECS
View Dockerfile
FROM php:7.2-apache
COPY --chown=www-data:www-data . /var/www/html/
COPY Docker/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY Docker/php.ini-development /usr/local/etc/php/php.ini
WORKDIR /var/www/html/
@andybeak
andybeak / fingerscrossed.php
Created Dec 3, 2019
Monolog fingerscrossed handler
View fingerscrossed.php
<?php
// composer require monolog/monolog
require('vendor/autoload.php');
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\FingersCrossedHandler;
use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;