Skip to content

Instantly share code, notes, and snippets.

View knowler's full-sized avatar
🦭
phoque it

Nathan Knowler knowler

🦭
phoque it
View GitHub Profile
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',
@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
@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    
│

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@swalkinshaw
swalkinshaw / tutorial.md
Last active February 26, 2025 21:15
Designing a GraphQL API
@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) =>
@koenhoeijmakers
koenhoeijmakers / BaseServiceProvider.php
Last active March 1, 2023 14:55
A Laravel ServiceProvider that actually merges the Config properly, taking multi-dimensional arrays into account.
<?php
namespace App\Providers;
use Illuminate\Support\Arr;
use Illuminate\Support\ServiceProvider;
class BaseServiceProvider extends ServiceProvider
{
/**
@dustinleblanc
dustinleblanc / .lando.yml
Created March 18, 2018 17:29
Setting up Laravel Dusk with ChromeDriver and Lando
name: cool-app
recipe: laravel
compose:
- docker-compose.yml
config:
php: '7.1'
via: nginx
webroot: public
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">