Skip to content

Instantly share code, notes, and snippets.

@wallacemaxters
wallacemaxters / PexelsImagesSearch.php
Created July 21, 2025 17:56
A custom Livewire component to use on Filament 4 to search imagens from Pexels.
<?php
namespace App\Livewire\Filament;
use App\Models\Post;
use Livewire\Component;
use Filament\Tables\Table;
use Filament\Actions\Action;
use Illuminate\Support\Facades\Http;
use Filament\Tables\Columns\TextColumn;
@wallacemaxters
wallacemaxters / console.php
Created July 14, 2025 23:59
Laravel command to install queue as Linux service
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Process;
Artisan::command('app:queue-service-install', function () {
$content = file_get_contents(base_path('stubs/queue.service.stub'));
@wallacemaxters
wallacemaxters / Base.php
Last active August 8, 2025 16:53
Templates prédefinidos para utilizar em um novo projeto Laravel
<?php
namespace App\View\Components\Layouts;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class Base extends Component
{
@wallacemaxters
wallacemaxters / atropos.blade.php
Last active August 1, 2023 20:10
Reusable component to easy use atropos in laravel
<!-- main Atropos container (required), add your custom class here -->
<div {{ $attributes->class('atropos') }}>
<!-- scale container (required) -->
<div class="atropos-scale">
<!-- rotate container (required) -->
<div class="atropos-rotate">
<!-- inner container (required) -->
<div class="atropos-inner">
{{ $slot }}
</div>
@wallacemaxters
wallacemaxters / speed_up_video.sh
Last active October 14, 2022 18:51
Speed up videos with ffmpeg command line
ffmpeg -i $1 -map 0:v -c:v copy -bsf:v h264_mp4toannexb raw.h264
ffmpeg -fflags +genpts -r 45 -i raw.h264 -c:v copy $2
rm raw.h264
@wallacemaxters
wallacemaxters / make_user_artisan.php
Created March 17, 2021 12:43
Comando para criar o usuário interativamente através da linha de comando do artisan. Command to create user from php artisan interactively.
<?php
Artisan::command('make:user', function () {
$email = $this->ask('Digite um e-mail');
$name = $this->ask('Digite o nome');
$password = $this->secret('Digite a senha');
$user = App\User::firstOrNew(['email' => $email]);
$exists = $user->exists;
@wallacemaxters
wallacemaxters / lista_cargos.json
Last active July 5, 2025 00:27
Lista de profissões/cargos em JSON
[
"abastecedor de linha de produção",
"abastecedor de máquinas",
"acabador de embalagens",
"acrilista",
"acupunturista",
"aderecista",
"adesivador",
"adestrador",
"administrador de contratos",
@wallacemaxters
wallacemaxters / json_encode_callback.php
Created August 9, 2018 20:39
json_encode implementation with callback, like JSON.stringify of the Javascript
<?php
/**
* @author Wallace Maxters <[email protected]>
* Encodes json after apply callback in data passed
*
* @param mixed $data
* @param callable $callback
* @param int $options
* @return string
@wallacemaxters
wallacemaxters / jotEvent.js
Last active May 9, 2018 16:59
Sugestão de manipulação de events para a biblioteca https://github.com/brcontainer/jot.js
(function (window) {
"use strict";
var forEach = Array.prototype.forEach;
var Event = function (nodeList) {
this.nodeList = nodeList;
};
var proto = Event.prototype;