Skip to content

Instantly share code, notes, and snippets.

View sawirricardo's full-sized avatar
👋

Ricardo Sawir sawirricardo

👋
View GitHub Profile
@marckohlbrugge
marckohlbrugge / assistant.rb
Created January 12, 2025 22:56
Overview of my LLM-powered prototype. Very rough code.
# Add these gems to your Gemfile
gem "rails" # not strictly needed, but I use ActiveConcern, etc
gem "raix" # helpful gem to reduce code needed for function calling etc
gem "thor" # to make a CLI app (not needed if you make a web app)
gem "http" # my preferred gem to make API calls
# This is the main app (`app/models/ai_chat/cli.rb`)
module AIChat
class Cli
# Thor
@Nuxnuxx
Nuxnuxx / nixpacks.toml
Last active December 5, 2024 02:20
Nixpacks for laravel with reverb
[phases.setup]
nixPkgs = ["...", "python311Packages.supervisor"]
[phases.build]
cmds = [
"mkdir -p /etc/supervisor/conf.d/",
"cp /assets/laravel-worker.conf /etc/supervisor/conf.d/laravel-worker.conf",
"cp /assets/supervisord.conf /etc/supervisord.conf",
"chmod +x /assets/start.sh",
"npm run build",
@Geczy
Geczy / readme.md
Last active March 10, 2025 06:54
Migrate Coolify to a new server
@adtac
adtac / Dockerfile
Last active February 28, 2025 02:18
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@hotmeteor
hotmeteor / ApaTitle.php
Created January 3, 2024 22:16
Laravel APA title case macro
<?php
namespace App\Providers\Macros;
class ApaTitle
{
public function __invoke()
{
return function ($string) {
// Define minor words to be lowercase
@keepanitreel
keepanitreel / select-action.php
Created December 29, 2023 01:27
FilamentPHP Select Input Actions for removing all / adding all in a Multiple Select input
/**
* Credit Sandro Gehri
* https://twitter.com/gehrisandro
*/
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Actions\Action;
Select::make('foo')
->options(['read','write','execute'])
@fabiolimace
fabiolimace / uuid.js
Last active December 29, 2024 15:48
No Dependency / Do It Yourself / You Know What You Are Doing UUID generator for Javascript
const v4 = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.trunc(Math.random() * 16);
const v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
const v7 = () => {
return 'tttttttt-tttt-7xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
@MrPunyapal
MrPunyapal / GenerateUniqueSlug.php
Created November 29, 2023 16:40
Efficient Laravel Slug Generation: Unique, Sleek, and No Looping 🚀
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Blog extends Model
{
@MrPunyapal
MrPunyapal / PostList.php
Created November 20, 2023 15:53
Optimized Load More Laravel livewire
<?php
namespace App\Livewire;
use App\Models\Post;
use Livewire\Component;
class PostList extends Component
{
public $offset = 0;