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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
const handleLogout = () => { | |
axios.post('/logout') | |
.then(() => location.href = '/home') | |
}; | |
function Example() { | |
return ( |
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
Copyright (C) 2016 Donnie Ray Jones | |
Permission is hereby granted, free of charge, to any person obtaining a | |
copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: |
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 | |
use PhpCsFixer\Config; | |
use PhpCsFixer\Finder; | |
$rules = [ | |
'phpdoc_indent' => true, | |
'binary_operator_spaces' => [ | |
'operators' => ['=>' => null] | |
], |
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
// Add this to the "boot()" method of your "AppServiceProvider" | |
<?php | |
\Illuminate\Database\Eloquent\Builder::macro('search', function ($name, $search) { | |
return $this->where($name, 'LIKE', $search ? '%'.$search.'%' : ''); | |
}); |
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 | |
// Usage: | |
// Before | |
@if ($errors->has('email')) | |
<span>{{ $errors->first('email') }}</span> | |
@endif | |
// After: |
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
let mix = require('laravel-mix'); | |
mix.js('src/index.js', 'dist/foo.js').sourceMaps(); | |
mix.webpackConfig({ | |
output: { | |
libraryTarget: 'umd', | |
} | |
}) |
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 puppeteer = require('puppeteer'); | |
const imagemin = require('imagemin'); | |
const imageminPngquant = require('imagemin-pngquant'); | |
// Get the URL and the slug segment from it | |
const url = process.argv[2]; | |
const segments = url.split('/'); | |
const slug = segments[segments.length-2]; | |
(async () => { |
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 | |
class FieldServiceProvider extends ServiceProvider{ | |
/** | |
* Bootstrap the field services. | |
* @return void | |
*/ | |
public function boot() | |
{ | |
Nova::serving(function (ServingNova $event) { | |
$files = app('files'); |
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 | |
require __DIR__ . '/vendor/autoload.php'; | |
use GuzzleHttp\Client; | |
$url = "https://domain.tld/large-file.mp4"; | |
$tmpFile = tempnam(sys_get_temp_dir(), 'guzzle-download'); | |
$client = new Client(array( |
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 | |
//Intervention Image Package: | |
//http://image.intervention.io | |
Route::get('generate', function(){ | |
$text = 'image/jpg'; | |
$width = 1600; | |
$height = 1000; | |
$centerH = $width/2; |