Skip to content

Instantly share code, notes, and snippets.

@danielstgt
danielstgt / update.md
Last active April 14, 2025 09:55
Upgrade ImageMagick and Imagick PHP extension

Upgrade ImageMagick Version to 7 with the Imagick PHP extension

Tested on Laravel Forge provisioned server with Ubuntu 22, PHP 8.3 and 8.4

Check the output of the current version, if it's already on v7 then you're done

php -r 'print_r(Imagick::getVersion());'
php8.3 -r 'print_r(Imagick::getVersion());'
php8.4 -r 'print_r(Imagick::getVersion());'
@danielstgt
danielstgt / convert.sh
Last active April 8, 2025 13:56
Convert JPG and PNG to AVIF
setopt extended_glob
for img in *.(#i)(jpg|jpeg|png)
do
if [ -f "$img" ]; then
name="${img%.*}"
if magick "$img" -strip -quality 60 -define heic:avif-speed=0 -define heic:subsample=420 "${name}.avif"
then
echo "🌇 Converted: $img -> ${name}.avif"
@danielstgt
danielstgt / MIGRATION.md
Last active January 7, 2025 11:48
Use Discord for Laravel Error Logging without 3rd party packages

Migration Guide

1) Get the webhook URL for your channel on Discord

Click on the channel settings icon and select integrations.

2) Create a new entry in your .env

LOG_DISCORD_WEBHOOK_URL=<insert-the-webhook-url-here>
@danielstgt
danielstgt / deploy.sh
Created December 18, 2024 00:23
bun install with frozen lockfile (recommended for production)
bun install --frozen-lockfile && bun run build
@danielstgt
danielstgt / README.md
Last active February 20, 2025 16:24
Umami installation/deployment and proxy

Proxy settings for the umami installation

    location / {
        proxy_pass http://127.0.0.1:3000;

        proxy_read_timeout     120;
        proxy_connect_timeout  40;
        proxy_redirect         off;
<template>
<svg>
<use :href="symbolId" />
</svg>
</template>
<script>
export default {
props: ['icon'],
<template>
<svg v-bind="svgAttributes" v-html="svgContent"></svg>
</template>
<script>
export default {
props: ['icon'],
data() {
return {
<template>
<svg
v-bind="svgAttributes"
v-html="svgContent"
>
</svg>
</template>
<script>
export default {
@danielstgt
danielstgt / app.css
Created February 11, 2022 09:22
CSS Home Bar Padding (Tailwind CSS)
@layer utilities {
.pb-safe {
padding-bottom: env(safe-area-inset-bottom);
}
}
@danielstgt
danielstgt / readme.md
Created February 4, 2022 19:03
Useful Redirect Headers

Useful Redirect Headers

Set a max age

Cache-Control: max-age=3600

The max-age=N response directive indicates that the response remains fresh until N seconds after the response is generated.