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
@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
*/
@ffoodd
ffoodd / improved-sr-only.markdown
Last active March 21, 2025 09:26
Improved .sr-only

Improved .visually-hidden

Theorically bulletproof CSS class for visually hide anything and keep it accessible to ATs.

A Pen by ffoodd on CodePen.

License.

@QWp6t
QWp6t / BedrockMultisiteValetDriver.php
Last active January 3, 2025 07:46
Fix Laravel Valet when using WordPress subdirectory multisite + Bedrock
<?php
namespace Valet\Drivers\Custom;
class BedrockMultisiteValetDriver extends \Valet\Drivers\Specific\BedrockValetDriver
{
/**
* Determine if the incoming request is for a static file.
*
* @return string|false
#!/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">
@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
@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
{
/**
@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) =>
@swalkinshaw
swalkinshaw / tutorial.md
Last active February 26, 2025 21:15
Designing a GraphQL API

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