Skip to content

Instantly share code, notes, and snippets.

Cristian Tabacitu tabacitu

Block or report user

Report or block tabacitu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CreatedByTrait.php
<?php namespace App\Models\Traits;
use Illuminate\Database\Eloquent\Model;
trait CreatedByTrait {
/**
* Stores the user id at each create & update.
*/
public function save(array $options = [])
@tabacitu
tabacitu / PermissionMiddleware.php
Created Jan 29, 2017
Laravel Role and Permission Middlewares
View PermissionMiddleware.php
<?php
namespace App\Http\Middleware;
use Closure;
use Auth;
class PermissionMiddleware
{
/**
@tabacitu
tabacitu / gist:dbcfd71375e72c857474
Last active Aug 22, 2018
Tabacitu Laravel Package Service Provider boilerplate code
View gist:dbcfd71375e72c857474
<?php
namespace League\Skeleton;
use Illuminate\Support\ServiceProvider;
use Illuminate\Routing\Router;
class SkeletonServiceProvider extends ServiceProvider
{
/**
@tabacitu
tabacitu / backpack.stack.css
Created Sep 20, 2018
Backpack overlay that makes AdminLTE match the Stack Multi-Purpose HTML Template
View backpack.stack.css
/* ------------------------------------------ */
/* ------- Backpack Stack Overlay ------------ */
/* ------------------------------------------ */
/* This file brings some subjective improvements to the AdminLTE style, to match the style provided by the Stack HTML Template. */
.sidebar-menu>li>a>.fa,
.sidebar-menu>li>a>.glyphicon,
.sidebar-menu>li>a>.ion {
margin-right: 5px;
}
@tabacitu
tabacitu / SolutionA.php
Created Oct 25, 2018
Proposal MonsterCrudConfiguration files
View SolutionA.php
<?php
namespace App\AdminPanel\Configurations;
use Illuminate\Http\Request;
class MonsterCrudConfiguration {
public static $model = 'App\Models\Monster';
public static $entityNameSingular = 'monster';
@tabacitu
tabacitu / .zshrc
Last active Jul 25, 2019
Quickly create a Backpack Demo, serve it with Laravel Valet, open it with Sublime Text and Brave Browser on Mac OS X
View .zshrc
# alias to the subl command
# for it to work, you need to create a symlink to the subl command somewhere in the PATH
# ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
alias sublime='subl'
# function to open the current directory in the browser, served by Laravel Valet
safari() {
open 'http://'$(basename $(pwd))'.test/';
}
@tabacitu
tabacitu / ssh.sql
Created Dec 29, 2019
MySQL Dump Large Table Entries In Chunks
View ssh.sql
## This process can be used to export a huge DB table. I've used it to export a 24GB table,
## containing 146 million records, into chunks of 25 million records, each chunk taking up aprox 500mb each.
##
## Of course, USERNAME, DATABASENAME and TABLENAME need to be replaced with actual values.
## First thing when it's run, it'll ask for that user's password.
##
## COMMAND BREAKDOWN:
## mysqldump - u [username] -p [databasename] [tablename]
## --no-create-info # don't include CREATE and DROP statements in the dump
## --where="" # filter the dumped rows
You can’t perform that action at this time.