Skip to content

Instantly share code, notes, and snippets.

@MWDelaney
MWDelaney / facetwp.php
Last active March 12, 2019 17:38
Rewrite the HTML output of radio buttons into a Bootstrap dropdown
<?php
// Adjust FacetWP "Radio" HTML output to be friendlier with our theme
add_filter('facetwp_facet_html', function ($output, $params) {
// Check that this facet is a "radio" type facet before proceeding.
if ('radio' == $params['facet']['type']) {
// Initialize our variables
$output = '';
@bikubi
bikubi / README.md
Created March 1, 2019 12:39
Simple Purgecss setup for Roots Sage WordPress starter theme

Why

  1. Sage doesn't come with Purgecss (or uncss, etc.)
  2. Say, we use Bulma -- suddenly dist/main.css grows by 400K!
  3. Let's purge it!
  4. Oh dang, we need to whitelist /\.wp-/, /\.post-type/, /myfancylightbox/...
  5. Wait we are whitelisting pretty much everything from /resource/assets/styles!
  6. Isn't there an option to purge /node_modules/**/* only?
  7. Nope.
  8. purgecss start ignore, strategically placed, to the rescue!
@laggardkernel
laggardkernel / startup-time-of-zsh.md
Last active March 21, 2025 02:56
Comparison of ZSH frameworks and plugin managers

Comparison of ZSH frameworks and plugin managers

Changelog

  • update 1: add a FAQ section
  • update 2: benchmark chart and feature comparison table
  • update 3:
    • improve the table with missing features for antigen
    • new zplg times result

TLDR

@EvanHerman
EvanHerman / config.yml
Last active December 3, 2021 02:56
WordPress Plugin CircleCI 2.0 Config - PHPCS, PHPUnit and rsync Deployment
workflows:
version: 2
main:
jobs:
- php56-build
- php70-build
- php71-build
- php72-build
- deploy:
requires:
@austinpray
austinpray / bad.jsx
Last active September 19, 2018 19:43
PostListing Refactor. I'm using .jsx filenames so I can get proper filenames in the gist use .js or typescript in your project
import React from 'react'
const PostListing = ({post}) => (
<article>
<h3>{post.frontmatter.title}</h3>
<span>{post.frontmatter.date}</span>
<p>{post.excerpt}</p>
</article>
)
@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
#!/bin/bash
# Regolith aka Un-Bedrock
# "But what if we need to hand it off to another agency?" No more!
# This script converts a Bedrock site to a normal WordPress structure.
# Run it from the root of a Bedrock project.
# Created by Nathan Knowler and Daniel Roe
echo "Converting Bedrock to a normal WordPress file structure..."
@dndhm
dndhm / AppWithContext.js
Last active March 30, 2023 09:17
React Context.Consumer mocking
import React, { Component } from 'react';
import FruitContext from './FruitContext';
import FruityComponent from './FruityComponent';
export class App extends Component {
state = {
fruit: 'apple',
}
@luzfcb
luzfcb / installing_pyenv_on_ubuntu_based_distros.md
Last active April 18, 2025 22:04
Quick install pyenv and Python

Tested only on Ubuntu 24.04, KDE Neon User Edition (based on Ubuntu 24.04) and OSX Mojave or higher.

will probably work on other newer versions, with no changes, or with few changes in non-python dependencies (apt-get packages)

NOTE: Don't create a .sh file and run it all at once. It may will not work. Copy, paste, and execute each command below manually. :-)

Ubuntu

# DO NOT RUN THIS AS A ROOT USER