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

Keybase proof

I hereby claim:

  • I am frolki1-dev on github.
  • I am frolki1_dev (https://keybase.io/frolki1_dev) on keybase.
  • I have a public key ASDN2n3tFjvT3LXwgzPgM7baCu7ELf_9nEeXs84EqRMhEgo

To claim this, I am signing this object:

@Frolki1-Dev
Frolki1-Dev / icons.php
Last active February 3, 2019 08:54
Get all icon classes of font awesome
<?php
$json = json_decode(file_get_contents('icons.json'));
$icons = [];
foreach ($json as $class => $icon) {
$name = 'fa-' . $class;
foreach ($icon->styles as $type) {
switch($type) {
@Frolki1-Dev
Frolki1-Dev / get_brightness.php
Created March 25, 2019 21:28
[PHP] Get the brightness of a color
<?php
/**
* Get the brightness of the color.
* The return value is between 0 and 1.
* 0 = light
* 1 = dark
*
* @param string $hex The hex code of the color
* @return float|int
*/
@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
@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 / 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 / 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 / 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 / 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 / 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();
});