Skip to content

Instantly share code, notes, and snippets.

View aaronjpitts's full-sized avatar

Aaron Pitts aaronjpitts

  • Barcelona, Spain
View GitHub Profile
@Log1x
Log1x / PostSearch.php
Last active June 27, 2024 07:59
Post Search component example using Acorn v4 and Livewire 3
<?php
namespace App\Livewire;
use Livewire\Attributes\Url;
use Livewire\Component;
use WP_Query;
class PostSearch extends Component
{
@joshuafredrickson
joshuafredrickson / filters.php
Last active May 5, 2024 08:24
Preload font files found in Roots Sage 10 (bud.js) manifest.json
<?php
use Illuminate\Support\Str;
/**
* Add `rel="preload"` to font files found in the manifest
*/
add_filter('wp_head', function (): void {
echo collect(
json_decode(asset('manifest.json')->contents())
@joshuafredrickson
joshuafredrickson / app.js
Created May 16, 2023 14:05
Dynamically loading Alpine components on page load.
import domReady from '@roots/sage/client/dom-ready';
/**
* Alpine components
*/
import Alpine from 'alpinejs';
import * as components from './components/index.js';
/**
@seothemes
seothemes / functions.php
Last active November 3, 2022 20:08
Convert WordPress spacing scale inline styles to utility classes and load conditionally
<?php
declare( strict_types=1 );
namespace Blockify;
use DOMDocument;
use DOMElement;
use function add_action;
use function add_filter;
@hhhonzik
hhhonzik / deploy.yml
Last active April 22, 2024 10:30
Kinsta Deployment
# Kinsta Deployment through Github Actions for Bedrock/Sage.
#
# Placed at: .github/workflow/deploy.yml
#
# Process should be studied from code, but some quick brief:
# - runs composer / sage installation
# - moves correct `.env.*` file for multiple configs
# - uses rsync to sync files, uses /.rsyncignore file to exclude whatever should not be there
# - symlinks uploads folder and symlink release folder to kinsta public hostname
# - if you want to clear cache, please uncomment the last job
@nicooprat
nicooprat / main.scss
Last active March 1, 2024 07:36
Sharing Tailwind config with SASS (Tailwind beta & Tailwind 1.0)
// Setting variables like this wouldn't be possible because SASS would
// get through this file before Tailwind does (because it's PostCSS)
$--color-primary: theme('colors.blue');
$--font-serif: theme('fontFamily.serif');
body {
color: rgba($--color-primary, .5);
font-family: $font-serif;
}
@kjbenk
kjbenk / class-taxonomy-top-level-url.php
Last active November 26, 2019 09:27
WordPress: Taxonomy Top Level URL
<?php
/**
* The class used to make certain taxonomies have a top level URL.
*/
/**
* The Taxonomy_Top_Level_URL class.
*/
class Taxonomy_Top_Level_URL {
/**
// Kevin Pilard @kpilard Apr 11 16:17
// @jamesxv7
import { Validator } from 'vee-validate';
var app = new Vue({
el: '#app',
created () {
this.validator = new Validator(this.validationRules)
},