View Select2Formatter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Traits; | |
trait Select2Formatter | |
{ | |
/** | |
* Format your array to the format used by select2 plugin using eloquent | |
* | |
* @param array $data |
View upload.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Uppy = require('@uppy/core'); | |
const XHRUpload = require('@uppy/xhr-upload'); | |
const Dashboard = require('@uppy/dashboard'); | |
const PortuguesBR = require('@uppy/locales/lib/pt_BR'); | |
/** | |
* Cria uma instância do plugin Uppy | |
* @param {String|Object} options objeto com algumas opções do plugin | |
*/ | |
window.uploadFiles = (options) => { |
View card.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
<div class="card"> | |
<div class="card-header" | |
@isset($cardHeadingId) | |
id="{{ $cardHeadingId }}" | |
@endisset | |
> | |
<h2 class="mb-0"> | |
<button |
View CloneController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Controllers; | |
use App\MyModel; | |
class CloneController extends Controller | |
{ | |
/** | |
* Replicate a model and his relationships | |
* | |
* @param $id |
View createDinamicallyElement.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check if the attribute key is camelcase | |
const isCamelCase = (str) => { | |
return /[A-Z]/.test(str) | |
} | |
//change the attribute from camelcase to hyphen separator | |
const changeSeparator = (str) => { | |
return str.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase(); | |
} |
View http-error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { format } from 'url'; | |
import { STATUS_CODES } from 'http'; | |
import uppercamelcase from 'uppercamelcase'; | |
class HTTPError extends Error { | |
constructor(code, message, extras) { | |
super(message || STATUS_CODES[code]); | |
if (arguments.length >= 3 && extras) { | |
Object.assign(this, extras); | |
} |
View .env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DB_CONNECTION=mysql | |
DB_HOST=http://localhost | |
DB_PORT=3306 | |
DB_DATABASE=forge | |
DB_USERNAME=root | |
DB_PASSWORD= | |
DB_CONNECTION2=mysql | |
DB_HOST2=http://localhost | |
DB_PORT2=3306 |
View Handler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Exceptions; | |
use Exception; | |
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | |
class Handler extends ExceptionHandler | |
{ | |
/** |
View gist:848370c0e133de40b9923b332b481bc3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Ex: | |
* include("http://mysite.com/bookmarklet.css"); | |
* include("http://mysite.com/bookmarklet.js"); | |
*/ | |
let include = ( src, callback ) => { | |
let ext = src.split( /[\#\?]/ )[ 0 ].split( '.' ).pop().toLowerCase(); | |
let inc; | |
if ( ext === 'css' ) { |
NewerOlder