Skip to content

Instantly share code, notes, and snippets.

View tylerforesthauser's full-sized avatar

Tyler Forest-Hauser tylerforesthauser

View GitHub Profile
@elyscape
elyscape / heartbeat
Last active November 3, 2023 03:59
Systemd configuration for healthchecks.io heartbeat
ENDPOINT=https://whatever
@zgordon
zgordon / enqueue-block-css.php
Last active October 11, 2023 13:50
This example shows how to use enqueue_block_assets to enqueue custom block CSS on the frontend of a theme and in the Gutenberg editor.
<?php
/**
* Enqueue block styles on frontend and in editor
*
*/
function mytheme_block_styles() {
wp_enqueue_style( 'mytheme-blocks', get_stylesheet_directory_uri() . '/css/blocks.css' );
@DreaMinder
DreaMinder / A Nuxt.js VPS production deployment.md
Last active July 31, 2024 13:56
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger than a landing page.

UPD: This manual now compatible with [email protected]. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

@MatthewVance
MatthewVance / rclone.service
Created July 11, 2018 02:45
Rclone Systemd service
[Unit]
Description=rclone - rsync for cloud storage
Documentation=https://rclone.org/docs/
After=network-online.target
Before=caddy.service
Wants=network-online.target systemd-networkd-wait-online.service
Requires=caddy.service
[Service]
Restart=on-abnormal
@cossssmin
cossssmin / gradients.js
Last active June 4, 2021 20:25
Tailwind CSS background-image gradients plugin
const _ = require('lodash');
module.exports = ({e, addUtilities, config}) => {
const gradients = config('gradients', [])
const variants = config('modules.gradients')
const gradientUtilities = _.map(gradients, (colors, name) => {
if (!_.isArray(colors)) {
colors = ['transparent', colors];
}
@Bas-Man
Bas-Man / plexDatabaseBackupScript.sh
Last active March 26, 2021 23:38 — forked from shnhrrsn/plexDatabaseBackupScript.sh
Plex Media Server database backup script of Mac OS
#!/usr/bin/env bash
# Backup a Plex database.
# Author Scott Smereka
# Ubuntu
# Version 1.0
# Modified by Shaun Harrison
# Ubuntu
# Version 1.1
@mc2squared
mc2squared / sa-gen.sh
Last active May 30, 2022 21:07 — forked from DashLt/create_service.sh
Generate 100 service accounts and export their keys
#!/bin/bash
# requires gcloud command line tools; go to https://cloud.google.com/sdk/docs/quickstarts to get them
# max 100 service accounts per project
# run gcloud init --console-only first and select a project
#
# Want to use these for rclone? Service Account Loadbalancing is implemented in this build:
# https://git.fionera.de/fionera/rclone/releases
KEYS_DIR=~/keys
for name in service{1..100}; do
echo $name
@mikeapr4
mikeapr4 / cache-queue.js
Last active April 16, 2021 20:46
more advanced version of a reactive method-style getter caching, with a size limit on the cache
// This utility is to keep track of a list of keys (entity IDs no doubt) in last access
// order. The oldest entities can be popped off the list, and new entities can be added.
// The premise is a bidirectional linked list along with an ID hash to an point in the
// linked list. The reason behind the complexity is performance.
export default () => {
let first = null;
let last = null;
const hash = {};
let size = 0;
@sandren
sandren / tailwind.md
Last active February 28, 2025 13:05
Tailwind CSS best practices

Tailwind CSS best practices

Utility classes

  1. When writing a string of multiple utility classes, always do so in an order with meaning. The "Concentric CSS" approach works well with utility classes (i.e,. 1. positioning/visibility 2. box model 3. borders 4. backgrounds 5. typography 6. other visual adjustments). Once you establish a familiar pattern of ordering, parsing through long strings of utility classes will become much, much faster so a little more effort up front goes a long way!

  2. Always use fewer utility classes when possible. For example, use mx-2 instead of ml-2 mr-2 and don't be afraid to use the simpler p-4 lg:pt-8 instead of the longer, more complicated pt-4 lg:pt-8 pr-4 pb-4 pl-4.

  3. Prefix all utility classes that will only apply at a certain breakpoint with that breakpoint's prefix. For example, use block lg:flex lg:flex-col lg:justify-center instead of block lg:flex flex-col justify-center to make it very clear that the flexbox utilities are only applicable at the

@jamesvidler
jamesvidler / get-sitemap-flat.curl
Last active January 22, 2021 18:44
Get a sitemap in a flat format, ideal for page routing from Agility CMS.
curl https://046a1a87-api.agilitycms.cloud/fetch/en-us/sitemap/flat/website
--header "APIKey: defaultlive.2b7f3a91559d794bedb688358be5e13af2b1e3ae8cd39e8ed2433bbef5d8d6ac"
{
"/home": {
"title": "Home",
"name": "home",
"pageID": 2,
"menuText": "New Home Text",
"visible": {
"menu": false,