Skip to content

Instantly share code, notes, and snippets.

View adinata-id's full-sized avatar

Adinata adinata-id

View GitHub Profile
<?php
// if you wanna use defer in a package where it may only be optional
// or you don't know or want to mess with if defer is already supported
// also swoole compatible if you get this error:
// Symfony\Component\ErrorHandler\Error\FatalError: Uncaught Swoole\Error: API must be called in the coroutine
if (! function_exists('safeDefer')) {
/**
@levelsio
levelsio / gist:5bc87fd1b1ffbf4a705047bebd9b4790
Last active March 31, 2025 01:23
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@MrPunyapal
MrPunyapal / ExportCSV.php
Last active December 31, 2023 07:29
PHP Function to Export Products as CSV (without saving it in server)
<?php
function exportCSV()
{
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename=products.csv');
header('Pragma: no-cache');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
@HelgeSverre
HelgeSverre / caddy-vapor-ssl.sh
Created March 28, 2023 12:37
Updated: Unlimited SSL Domain on Laravel Vapor
# Stop and disable NGINX
sudo systemctl stop nginx
sudo systemctl disable nginx
# Install Go
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.20.2.linux-amd64.tar.gz
rm -f go1.20.2.linux-amd64.tar.gz
includes:
- ./vendor/nunomaduro/larastan/extension.neon
parameters:
paths:
- app/
level: 5
@plembo
plembo / s3backup.md
Last active December 20, 2024 03:16
S3 Backup

Backup with AWS S3

Amazon Web Services' Simple Storage Service, a/k/a "S3", is a flexible object storage facility that is widely used by government, enterprises, and even small business for serving and backing up files. Creating a storage "bucket" is easy enough, but most consumers find the permissioning system to be indecipherable. That wasn't as much of a problem for me, as I've been through a few rounds of AWS training, including for S3. But it also wasn't straightforward. I'm creating this gist mostly to avoid having to puzzle things out for my next S3 project.

Overview

The goal is to backup files on my home server to an S3 bucket. In the example that follows "example.com" is my home domain.

Third party software

aws-cli is the official command-line tool for AWS.

rclone is "rsync for cloud storage", a reliable and efficient tool for synchronizing storage nodes. Instructions for

@bezhanSalleh
bezhanSalleh / ModelResource.php
Last active July 31, 2022 23:26
Filament Dynamic UI for Role and Permissions | Toggel + Checkboxes
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Grid::make()
->schema([
Forms\Components\Card::make()
->schema([
Forms\Components\TextInput::make('name')
->required()
Open File -> App\Providers\AppServiceProvider
And change method boot
public function boot()
{
config(['app.locale' => 'id']);
Carbon::setLocale('id');
}
Open File and changes -> config/app.php