Skip to content

Instantly share code, notes, and snippets.

View knowler's full-sized avatar

Nathan Knowler knowler

View GitHub Profile
@runofthemill
runofthemill / roots-aliases.plugin.zsh
Last active August 8, 2018 15:09
Aliases for navigating a Roots project in a local environment. Inspired by https://gist.github.com/knowler/7c0686c4c1876980657f369213287749
root() {
local root
if [[ "$PWD" == *"/trellis"* ]]; then
root=${PWD%/trellis*}
elif [[ "$PWD" == *"/site"* ]]; then
root=${PWD%/site*}
elif [[ -d "$PWD/trellis" || -d "$PWD/site" ]]; then
root=${PWD}
fi
static propertyControls: PropertyControls = {
text: { type: ControlType.String, title: 'Text' },
fontSize: {
type: ControlType.FusedNumber,
toggleKey: 'fontPerBP',
toggleTitles: ['Font', 'Font per BP'],
valueKeys: ['font1', 'font2', 'font3', 'font4'],
valueLabels: theme.breakpoints.map(s => s.replace('px', '')),
min: 0,
title: 'Font Size',
@dgrijuela
dgrijuela / index.html
Created January 12, 2016 15:17
Code for the article How to Make Your Blog Work Offline: https://blog.redradix.com/how-to-make-your-blog-work-offline
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
// Test if service workers are supported
if ('serviceWorker' in navigator) {
<?php
/**
* Plugin Name: WP REST API Strict Mode
* Description: Triggers an error when unregistered parameters are used.
* Author: Ryan McCue
* Author URI: http://rmccue.io/
* Version: 0.1
*
* Requires https://core.trac.wordpress.org/ticket/35507
*/
@souporserious
souporserious / clone-children.js
Last active April 16, 2020 03:29
Utilities to join and clone React children.
/**
* Used to clone and apply props to children
*/
function cloneChildren(children, callback) {
const childrenArray = React.Children.toArray(children).filter(
child => child !== undefined && child !== null && child !== false
)
const childrenCount = childrenArray.length
return childrenArray.map(
(child, index) =>
@jbrinley
jbrinley / opcache.preload.php
Created December 22, 2019 20:16
WordPress core opcache.preload
<?php
declare( strict_types=1 );
$wp_dir = '/application/www/wp/';
$preload_patterns = [
$wp_dir . "wp-includes/Text/Diff/Renderer.php",
$wp_dir . "wp-includes/Text/Diff/Renderer/inline.php",
$wp_dir . "wp-includes/SimplePie/**/*.php",
$wp_dir . "wp-includes/SimplePie/*.php",
@bdmason
bdmason / using-sage-9-blade-templates-for-woocommerce.md
Last active October 26, 2022 10:48
Using Sage 9 blade templates for WooCommerce

Using Sage 9 blade templates for WooCommerce

Declare WooCommerce theme support

Open app/setup.php, find the after_setup_theme action and put add_theme_support('woocommerce'); inside the function.

Override the plugin templates

Add the templates you want to override in resources/woocommerce:

theme    
│
@gkeep
gkeep / iceberg_light.conf
Last active November 11, 2022 09:17
Iceberg light theme for kitty terminal
background #e8e9ec
foreground #33374c
selection_background #d2d4dd
selection_foreground #33374c
cursor #33374c
cursor_text_color #e8e9ec
# white
@louim
louim / uploads.yml
Last active December 23, 2022 14:20
Drop-in playbook for Trellis to push and pull uploads from the server to your local machine.
---
- name: Sync uploads between environments
hosts: web
remote_user: "{{ web_user }}"
vars:
project: "{{ wordpress_sites[site] }}"
project_root: "{{ www_root }}/{{ site }}"
tasks: