Skip to content

Instantly share code, notes, and snippets.

@rubenestevao
rubenestevao / progress-bar.blade.php
Created January 28, 2021 23:03 — forked from gwleuverink/progress-bar.blade.php
Progress bar blade component
@props([
'percentage' => 0,
'failed' => false
])
@php
$done = $failed || $percentage == 100;
@endphp
<div {{ $attributes->merge(['class' => ' space-y-1'])->whereDoesntStartWith('wire:poll') }}
@rubenestevao
rubenestevao / gist:8636575c4c17428417e1e6a73fb80c97
Created August 1, 2019 16:06 — forked from terwey/gist:0594905cd03e472679ff
PHP Imagick (ImageMagick) TIFF to JPG
// So ImageMagic is pretty cool, -but- it can sometimes consider a TIFF
// to be "metadata" that should be part of your thumbnailed JPG.
$Thumb = new \Imagick();
$Thumb->setResolution(72,72); // set the DPI of $Thumb to 72dpi, it's the WEB!
$data = file_get_contents('/data/some_image.jpg'); // secretly a TIFF pretending to be a JPG
// else make $data be something that came from curl_exec
$Thumb->readImageBlob($data);
$Thumb->setCompressionQuality(80); // you know, why have a 100compression quality thumbnail?
$Thumb->resampleImage(72,72,imagick::FILTER_UNDEFINED,1); // VERY IMPORTANT, without this it'll just "set" the DPI
@rubenestevao
rubenestevao / laravel-worker.conf
Last active July 21, 2019 16:37 — forked from mozillazg/supervisord.service
install and configure supervisord on centos 7.
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/slingshotdev/code/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=slingshotdev
numprocs=1
redirect_stderr=true
stdout_logfile=/home/slingshotdev/code/storage/logs/worker.log
@rubenestevao
rubenestevao / laravel-ddd-approach.md
Created July 9, 2019 15:26 — forked from ibrunotome/laravel-ddd-approach.md
A Domain Driven Design (DDD) approach to the Laravel Framework
/app
├── /Application
|  ├── /Exceptions
|  ├── /Middlewares
|  ├── /Providers
|  ├── /Requests
├── /Domain
|  ├── /MyDomainA
| | ├── /Contracts
<script>
/**
* @link https://jsfiddle.net/adamwathan/2juusxqo/
*/
const erd = elementResizeDetectorMaker({ strategy: 'scroll' });
export default {
data() {
return {
width: null,
<script>
/**
* @link https://jsfiddle.net/adamwathan/dootdso8/
*/
export default {
props: ['initialData', 'created', 'mounted'],
data() {
return {
data: this.$props.initialData
<script>
const isNaN = Number.isNaN || window.isNaN;
export default {
props: ['pagination'],
data() {
return {
page: this.pagination.current_page,
};
@rubenestevao
rubenestevao / PasswordCheck.php
Last active July 30, 2018 19:59
Laravel password check rule
<?php
declare(strict_types=1);
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;