Skip to content

Instantly share code, notes, and snippets.

View thinkverse's full-sized avatar
🫶

Kim Hallberg thinkverse

🫶
View GitHub Profile
@markshust
markshust / README.md
Last active August 15, 2025 21:50
Zero-downtime Laravel deployment with GitHub Actions

GitHub Actions Deploy Script - Environment Variables Setup Guide

This guide explains how to set up the required environment variables (GitHub Secrets) for the Laravel deployment GitHub Actions workflow.

Overview

The deployment script uses GitHub Secrets to securely store sensitive information like SSH keys and server details. These secrets are referenced in the workflow using the ${{ secrets.SECRET_NAME }} syntax.

Required Secrets

@MrPunyapal
MrPunyapal / TimeoutGuard.php
Created June 13, 2025 18:12
PHP Tick-Based Timeout Wrapper (No pcntl Required)
<?php
/**
* TimeoutGuard — A lightweight timeout wrapper using PHP ticks.
*
* This lets you interrupt execution of any callable if it exceeds a time limit.
* Works even on Windows (unlike pcntl).
*
* ⚠️ Requires `declare(ticks=1);`
*/
@emilyliu7321
emilyliu7321 / bluesky-comments.tsx
Created November 25, 2024 05:39
Integrate Bluesky replies as your blog's comment section
"use client";
/* eslint-disable @next/next/no-img-element */
import Link from "next/link";
import { useState, useEffect } from 'react';
import {
AppBskyFeedDefs,
AppBskyFeedPost,
type AppBskyFeedGetPostThread,
} from "@atproto/api";
# SETUP #
DOMAIN=example.com
PROJECT_REPO="[email protected]:example.com/app.git"
AMOUNT_KEEP_RELEASES=5
RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S)
RELEASES_DIRECTORY=~/$DOMAIN/releases
DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME
# stop script on error signal (-e) and undefined variables (-u)
@valorin
valorin / .env.example
Last active September 15, 2025 07:05
CSP Middleware - the simple CSP middleware I use across all of my projects.
# Add to your .env.example and .env files
CSP_ENABLED=true
CSP_REPORT_ONLY=true
@Illizian
Illizian / DateTimeComponent.php
Last active September 28, 2021 14:05
Laravel localised DateTimes with UTC Database storage
<?php
namespace App\View\Components;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Carbon;
use Illuminate\View\Component;
class DateTime extends Component
{
@thinkverse
thinkverse / gallery.css
Last active June 8, 2021 02:59
Single-line images gallery with `array_*` functions and `scandir`.
@whitep4nth3r
whitep4nth3r / gist:e6b10ef17636e29010d7a8b57800685e
Created May 5, 2021 12:13
Delete all branches merged into main
// Add to your shell configuration to improve your life!
dam() {
git checkout main && git branch --merged | egrep -v "(^\*|main)" | xargs git branch -d
}
@lukeraymonddowning
lukeraymonddowning / Macro.php
Created March 26, 2021 09:36
Tailwind specificity helper for Laravel Blade
ComponentAttributeBag::macro('fallback', function($classes) {
$fallbacks = Collection::wrap($classes)
->mapWithKeys(fn($partial, $fallback) => is_int($fallback) ? [$partial => Str::of($partial)->before("-")->when(Str::contains("-", $partial), fn($string) => $string->append('-'))->__toString()] : [$fallback => $partial])
->toArray();
return $this->class($fallbacks);
});
@thinkverse
thinkverse / tailwind-v1.config.js
Last active September 26, 2024 15:26
Useful TailwindCSS config that saves paddings and margins upon build
// https://v1.tailwindcss.com/docs/controlling-file-size#purge-css-options
module.exports = {
future: {
removeDeprecatedGapUtilities: true,
purgeLayersByDefault: true,
},
purge: {
content: ['./public/**/*.html'],
options: {
whitelistPatterns: [