Skip to content

Instantly share code, notes, and snippets.

@kauhat
kauhat / formkit.config.ts
Created July 26, 2023 15:19
FormKit DaisyUI classes
import { generateClasses } from '@formkit/themes';
import { defaultConfig } from '@formkit/vue';
const textClassification = {
outer: '',
wrapper: '',
inner: 'join',
help: '',
message: '',
label: 'label',
@kauhat
kauhat / shell.nix
Created December 24, 2021 21:47
Laravel Nix workspace
{ pkgs ? import <nixpkgs> { } }:
let
# Provide a script to start the Docker service.
daemonServiceScript =
pkgs.writeScript "check-daemon-service" ''
#!${pkgs.runtimeShell}
echo "Checking Docker service..."
@kauhat
kauhat / .gitattributes
Created June 9, 2020 22:09
Git LFS common web binary extensions
# Archives
*.7z filter=lfs diff=lfs merge=lfs -text
*.br filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
# Documents
*.pdf filter=lfs diff=lfs merge=lfs -text
@kauhat
kauhat / acf.php
Last active July 23, 2019 15:10
Sage Advanced Custom Fields helpers
<?php
namespace App;
/**
* Init
*/
add_action('acf/init', function () {
// Use Google API key from .env
acf_update_setting('google_api_key', GOOGLE_API_KEY);
@kauhat
kauhat / .sh
Last active July 3, 2019 11:27
Bedrock essential plugins
composer require "wpackagist-plugin/better-wp-security" \
"wpackagist-plugin/breeze" \
"wpackagist-plugin/classic-editor" \
"wpackagist-plugin/iwp-client" \
"wpackagist-plugin/redis-cache" \
"wpackagist-plugin/safe-redirect-manager" \
"wpackagist-plugin/simple-page-ordering" \
"wpackagist-plugin/user-switching" \
"wpackagist-plugin/widget-css-classes" \
"wpackagist-plugin/wordpress-seo" \
@kauhat
kauhat / helpers.php
Created June 13, 2019 10:29
Laravel asset modtime cache busting
<?php
if (! function_exists('asset_busted')) {
/**
* Generate an asset path with modification time query string.
*
* @param string $path
* @param bool|null $secure
* @return string
*/
@kauhat
kauhat / case-in-update.sql
Created January 11, 2018 12:33
Using a CASE/WHEN/THEN/ELSE statement within an UPDATE query.
UPDATE `organisations`
SET `description` = CASE id
WHEN 1 THEN 'something'
WHEN 2 THEN 'something else'
WHEN 3 THEN 'we\'re on the third record still'
WHEN 5 THEN 'we\'ve jumped to record five'
WHEN 6 THEN '...'
ELSE NULL
END
@kauhat
kauhat / copyBetweenDisks.php
Created December 14, 2017 12:44
Upload & copy files between disks in Laravel 5
<?php
use Illuminate\Http\File;
use Storage;
/**
* Load contents of file into memory and copy. Slower, but can copy from
* remote disks.
*
* @return void
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
class MenuServiceProvider extends ServiceProvider
{
/**
@kauhat
kauhat / mailcheck.js
Created August 22, 2017 09:38
Progressively enhance email inputs using mailcheck.js
/**
* Dynamically add mailcheck to specified input fields on page load.
* To use this, add the `mailcheck` class to your input elements.
* Optionally use a `data-mc-hint-class` attribute to customize the class used for the hints.
* See https://github.com/mailcheck/mailcheck for more
*/
import mailcheck from 'mailcheck'
import _ from 'lodash'