Skip to content

Instantly share code, notes, and snippets.

View thinkverse's full-sized avatar
🦖

Kim Hallberg thinkverse

🦖
View GitHub Profile
@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 December 24, 2024 18:18
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: [
@5t3ph
5t3ph / element-classes-and-ids-vanilla.css
Last active January 25, 2022 04:06
Tag HTML elements with their class names and IDs to visualize page structure
*[class],
*[id] {
position: relative;
outline: 2px dashed red;
}
*[class]::before, *[class]::after,
*[id]::before,
*[id]::after {
position: absolute;
@ybiquitous
ybiquitous / skip-ci-on-actions.yml
Last active February 9, 2021 10:11
How to "[skip ci]" on GitHub Actions
# See also:
# - https://github.com/actions/runner/issues/774
# - https://help.github.com/en/actions/reference/events-that-trigger-workflows#push-event-push
# - https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request
# - https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
name: "[skip ci]" on Actions
on: [push, pull_request]