View AppServiceProvider.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
//In order to get more accurate remaining time when using Laravel Progress Bar add this to AppServerProvider@boot | |
use Symfony\Component\Console\Helper\ProgressBar; | |
ProgressBar::setPlaceholderFormatterDefinition('remaining', function($bar) { | |
$remaining = $bar->getRemaining(); | |
$hours = floor($remaining / 3600); | |
$minutes = floor(($remaining / 60) % 60); | |
$seconds = $remaining % 60; | |
return sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds); |
View gist:6dd5346e5844eff598639af0654d5b42
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 | |
/* | |
This will avoid doing this all the time. | |
public function index(Request $request) | |
{ | |
$query = Model::with(['foo, 'bar'); | |
return ModelResource::collection($request->input('per_page') |
View Fix Incorrect datetime value: '0000-00-00 00:00:00'
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
# If you've accidentally got '0000-00-00 00:00:00' in a datetime field you can't fix it with this: | |
UPDATE table SET datetime = NULL WHERE datetime = '0000-00-00 00:00:00' | |
# Because you'll get this error: | |
Incorrect datetime value: '0000-00-00 00:00:00' | |
# But you can fix it with this |
View 0_reuse_code.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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View gist:cbf47487b8e531e122621c42ee4a687c
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
#!/usr/bin/env bash | |
# Backup uploaded files | |
aws s3 sync ~sortitoutsi/httpdocs/public/uploads/files s3://sortitoutsi/files --size-only --storage-class 'STANDARD_IA' | |
# Backup uploaded images | |
aws s3 sync ~sortitoutsi/httpdocs/public/uploads/images s3://sortitoutsi/images --size-only --storage-class 'STANDARD_IA' | |
# Backup career stats | |
aws s3 sync ~sortitoutsi/httpdocs/public/uploads/careerstats s3://sortitoutsi/careerstats --size-only --storage-class 'STANDARD_IA' |