Skip to content

Instantly share code, notes, and snippets.

Muah ctf0

Block or report user

Report or block ctf0

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
@ctf0
ctf0 / Api Stuff.md
Last active Jul 14, 2019
api/web essentials
View Api Stuff.md
  • kernel.php
protected $middlewareGroups = [
    'api' => [
            \App\Http\Middleware\External\CheckForApiHeaderExistence::class,
            'setDefaultAuthGuard:api',
            \App\Http\Middleware\External\ChangeAppLocale::class,
            'throttle:60,1',
            'bindings',
    ],
View array min items.md
  • langs/*/validation.php
'array_min_items' => 'at least :value :attribute is required',
  • AppServiceProvider.php
Validator::extend('arrayMinItems', function ($attribute, $value, $parameters, $validator) {
    $validator->addReplacer('arrayMinItems', function ($message, $attribute, $rule, $parameters) {
        return str_replace(':value', $parameters[0], $message);
View override.md

Border Reset

"activityBar.border": "#00000000",
"diffEditor.border": "#00000000",
"diffEditor.insertedTextBorder": "#00000000",
"diffEditor.removedTextBorder": "#00000000",
"dropdown.border": "#00000000",
"editor.findMatchBorder": "#00000000",
"editor.findMatchHighlightBorder": "#00000000",
"editor.findRangeHighlightBorder": "#00000000",
View ScrollingLettersAnimation.js
/**
* demo1.js
* http://www.codrops.com
* https://github.com/codrops/ScrollingLettersAnimation
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2018, Codrops
* http://www.codrops.com
View change model date format.php
<?php
namespace App\Traits;
use Carbon\Carbon;
use Jenssegers\Date\Date;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
trait HasTranslatedDates
{
@ctf0
ctf0 / paginate.php
Last active Mar 23, 2019 — forked from vluzrmos/paginate.php
Laravel Paginate Collection or Array
View paginate.php
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
*
* @return LengthAwarePaginator
*/
View url & views in laravel.md
  • add to events
// EventServiceProvider@boot()

use Illuminate\Foundation\Http\Events\RequestHandled;

app('events')->listen(RequestHandled::class, function ($event) {
    $request  = $event->request;
    $response = $event->response;
    $view = $response->original;
View hashId.md

Dont

  • hash the id on either boot::retrieved or getIdAttribute() because delete() & forceDelete() wont work as they create a new query which will keep getting the same hashed id

  • use Route::bind in the service provider as its applying the bind globally.

Maybe

  • save the hashed id to the db same as UUID but if u r using mysql, indexing will suffer
You can’t perform that action at this time.