Skip to content

Instantly share code, notes, and snippets.

View micc83's full-sized avatar

Alessandro Benoit micc83

View GitHub Profile
micc83 / fix-msyql-1067.php
Created June 22, 2021 13:21
Fix issues with: 1067 Invalid default value for 'created_at'
// Fix issues with: 1067 Invalid default value for 'created_at'
MODIFY created_at TIMESTAMP null,
MODIFY updated_at TIMESTAMP null
micc83 / sepa.php
Created May 28, 2021 15:39
Stripe SEPA full php example
* @see
use Stripe\Customer;
use Stripe\SetupIntent;
use Stripe\Stripe;
use Stripe\Subscription;
micc83 / TestCase.php
Created May 13, 2021 08:19
Assert a given command is scheduled once on Laravel Task Scheduling
namespace Tests;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Str;
abstract class TestCase extends BaseTestCase
micc83 / upload.js
Created April 30, 2021 13:03 — forked from virolea/upload.js
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) /
let data = new FormData()
data.append('file', files[0])
micc83 / settings.json
Last active July 22, 2020 12:51
Windows Terminal config file
// This file was initially generated by Windows Terminal 0.11.1251.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see:
"$schema": "",
micc83 /
Created December 20, 2018 08:51
Tail for commands on Mac
botch() {
while true; do
(echo -en '\033[H'
bash -c "$CMD" | while read LINE; do
echo -n "$LINE"
echo -e '\033[0K'
echo -en '\033[J') | tail -r | tail -r
sleep 2
micc83 / .zshrc
Created November 13, 2018 10:17
Laradock bash aliases
alias ld-up="(cd laradock;docker-compose up -d apache2 mariadb)"
alias ld-down="(cd laradock;docker-compose down)"
alias ld-ssh="(cd laradock;docker-compose exec workspace bash)"
micc83 / .htaccess
Created January 30, 2018 14:44
Maintenance mode through .htaccess
# Create file maintenance.html then
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance.html [R=302,L]
micc83 / mysqldump.php
Created June 5, 2017 13:17
Simple PHP script to dump a MySql database
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';
micc83 / snapshot.php
Last active January 4, 2019 07:09
PHPUnit Assertion that asserts the response content match a previous taken snapshot
* Assert the response content match a previous taken snapshot.
* If the snapshot doesn't exists on the first run it gets
* created and the test is marked as incomplete.
private function seeSnapshot()
$testName = debug_backtrace()[1]['function'];
$filename = "snapshots/{$testName}.json";