Skip to content

Instantly share code, notes, and snippets.

@ErikFontanel
ErikFontanel / TimberPatternLabLoader.php
Created July 28, 2017 14:07
Wordpress Timber Pattern Lab Pattern Loader
/**
* Custom PatternLab Loader for Timber
*
* How to use:
* Place this somewhere in your functions.php, make sure Timber WordPress plugin is installed and activated.
* This code assumes Pattern Lab is installed in the same directory as your theme.
* Change $patternlabSource below if you want to use a different path to Pattern Lab.
*
* This code hooks into Timber when Timber initialises the Twig_Loader_Filesystem
* uses default Timber loader if Pattern Lab patterns aren't found.
@tabrindle
tabrindle / webp-convert-directory.sh
Last active April 30, 2024 14:03
Convert all files in directory to webp, with default params, or standard cwebp params passed from command
#!/bin/bash
PARAMS=('-m 6 -q 70 -mt -af -progress')
if [ $# -ne 0 ]; then
PARAMS=$@;
fi
cd $(pwd)
@ghalusa
ghalusa / youtube_id_regex.php
Created June 20, 2015 23:14
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@blech75
blech75 / README.md
Last active March 19, 2024 00:50
notify-send adapter

notify-send adapter for Mac OS X

This allows you to receive desktop notifications from grunt running inside of a local vagrant box.

How to install

Install grunt-notify and add to dev dependencies

This is done on the guest VM (within the vagrant box).

@chales
chales / cache-warmer-3.sh
Last active January 19, 2022 14:01
A couple of simple options to parse sitemap.xml to warm the cache or for other actions such as generating memory_profiler checks.
# This can be added to your cron job to run right after Drupal's cron or combine them into a single command so
# that it automatically executes when the cron run completes.
wget -q http://www.example.com/sitemap.xml -O - | egrep -o "http://www\.example\.com[^<]+" | wget -q -i - -O /dev/null --wait 1