Skip to content

Instantly share code, notes, and snippets.

Avatar
🇧🇪
Never stop learning!

Ivan Vermeyen ivanvermeyen

🇧🇪
Never stop learning!
View GitHub Profile
@garethredfern
garethredfern / .env.github
Last active Feb 22, 2021
Github workflow for Laravel CI testing using a MYSQL database.
View .env.github
APP_ENV=ci
APP_KEY=
SESSION_DRIVER=array
CACHE_DRIVER=array
QUEUE_DRIVER=sync
MAIL_DRIVER=log
@calebporzio
calebporzio / error_blade_directive.php
Created Mar 28, 2019
A little Blade directive to make working with validation errors a bit nicer.
View error_blade_directive.php
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After:
@calebporzio
calebporzio / webpack.mix.js
Created Mar 2, 2019
A webpack.mix.js file for writing NPM packages the way you write JS in a Laravel app.
View webpack.mix.js
let mix = require('laravel-mix');
mix.js('src/index.js', 'dist/foo.js').sourceMaps();
mix.webpackConfig({
output: {
libraryTarget: 'umd',
}
})
@ivanvermeyen
ivanvermeyen / HOWTO.md
Last active Nov 19, 2021
Multiple MySQL versions on MacOS with Homebrew
View HOWTO.md

Update - 4 september 2020

Making multiple MySQL versions work with Homebrew was tricky to say the least. Fortunately there are 2 new easy ways that I learned of to achieve this.

DBngin app

As @4unkur and @henrytirla commented below, there is this extremely easy to use app called DBngin, which lets you setup multiple databases (not only MySQL) simultaneously using different ports:

https://dbngin.com/

@kaphert
kaphert / ViewAssertions.php
Created Sep 14, 2018
Assert that blade view files are loaded with PHPUnit in Laravel
View ViewAssertions.php
/**
* Laravel + PHPUnit assert that blade files are being loaded.
*
* Trait AssertView
*/
trait ViewAssertions
{
protected $__loadedViews;
protected function captureLoadedViews()
@ivanvermeyen
ivanvermeyen / Vessel.md
Last active Dec 19, 2018
Docker Project Setup with Vessel
View Vessel.md
@juukie
juukie / macro.php
Created Nov 7, 2017
Laravel social media url macro
View macro.php
<?php
URL::macro('social', function ($name, $replacement = '#') {
return array_get([
'facebook' => 'https://www.facebook.com/mypage/',
'instagram' => 'https://www.instagram.com/mypage/',
'pinterest' => 'https://nl.pinterest.com/mypage/',
], $name), $replacement);
});
@mort3za
mort3za / git-auto-sign-commits.sh
Last active Dec 8, 2021
Auto sign your git commits
View git-auto-sign-commits.sh
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@jeffochoa
jeffochoa / RouterServiceProvider.php
Created Jul 30, 2017
Get collection of available routes in Laravel
View RouterServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Route;
use Illuminate\Routing\Route as Router;
class RouterServiceProvider extends ServiceProvider
{
@ORESoftware
ORESoftware / resize-base64.js
Last active Dec 7, 2021
resizing an image on the front-end before sending to a server
View resize-base64.js
// Using this code, we can retrieve an image from a user's filesystem, resize the image, and then upload the image
// to a server using AJAX. Because we use base64 encoding, we can just include the image data as just another string value
// in a JSON payload.
// So we can use AJAX to send the file to a server, which is convenient.
// We have one line of relevant html
// get file in the first place => <input type="file" custom-on-change="onAcqImageFileChange" class="form-control">