Skip to content

Instantly share code, notes, and snippets.

View Frolki1-Dev's full-sized avatar
💘
Love to code

Frank Giger Frolki1-Dev

💘
Love to code
View GitHub Profile
@Frolki1-Dev
Frolki1-Dev / command.php
Last active September 2, 2020 20:35
Artisan command to create model, migrations, factories, controller and resources in one run
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
class CreateEntities extends Command
{
/**
@Frolki1-Dev
Frolki1-Dev / after.sh
Created May 12, 2020 13:18
[Homestead] My after.sh script
#!/bin/sh
POLICY_FILE=/etc/ImageMagick-6/policy.xml.bak
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
#
# If you have user-specific configurations you would like
# to apply, you may also create user-customizations.sh,
@Frolki1-Dev
Frolki1-Dev / disable-autocomplete.js
Created April 19, 2020 14:44
[HTML] Disable on all forms the autocomplete function
$('form').each(function () {
if(!$(this).is('[autocomplete]') && !$(this).data('allow_autocomplete')) {
$(this).attr('autocomplete', 'off');
}
});
@Frolki1-Dev
Frolki1-Dev / hold_dropdown_open.js
Created April 19, 2020 14:42
[Bootstrap] Hold dropdown open after click
$('.dropdown-menu.dropdown-hold-open').click(function(e) {
e.stopPropagation();
});
@Frolki1-Dev
Frolki1-Dev / RunFactory.php
Created April 18, 2020 14:51
[Laravel] A command which can run all factories in Laravel.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class RunFactory extends Command
{
/**
* The name and signature of the console command.
@Frolki1-Dev
Frolki1-Dev / index.php
Created April 8, 2020 19:57
[Laravel] Load a different .env file
/**
* Put this line in index.php
*/
$hostname = gethostname();
if (($d = strpos($hostname, '.')) !== false) {
$hostname = substr($hostname, 0, $d);
}
putenv('APP_ENV=' . $hostname);
@Frolki1-Dev
Frolki1-Dev / GeneratePoliciesFromModel.php
Last active March 22, 2020 18:10
[Laravel] Create for every model a policy file
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
class GeneratePoliciesFromModel extends Command
{
/**
@Frolki1-Dev
Frolki1-Dev / gitUpdate.sh
Created January 31, 2020 10:25
Update project over terminal easy
#!/bin/bash
# Set variables
PROJECT_PATH=$1
SSH_KEY=${2:-~/.ssh/git}
LARAVEL_PROJECT=0
GIT_RESET=0
RUN_COMPOSER=0
RUN_NPM=0
@Frolki1-Dev
Frolki1-Dev / laravelSetPermission.sh
Created January 31, 2020 09:48
Setup Laravel file and directory permission for deployment on production
#!/bin/bash
echo "Setup the permission for Laravel project."
echo "Laravel base directory is $1"
echo ""
echo "Set owner to www-data"
chown -R www-data:www-data $1
echo ""
echo "Set all files to 644"
@Frolki1-Dev
Frolki1-Dev / pre-commit
Created April 21, 2019 08:20
Compile assets before commit
#!/bin/sh
# Before commit minify the assets
yarn run prod
# Add files (if has some new files)
git add ./public