Skip to content

Instantly share code, notes, and snippets.

@aarongustafson
aarongustafson / watchResize.js
Last active September 16, 2019 14:37
Efficient callback management for window.onresize
(function( window ){
window.watchResize = function( callback ){
var resizing;
callback.size = 0;
function done()
{
var curr_size = window.innerWidth;
clearTimeout( resizing );
resizing = null;
// only run on a true resize
// Vanilla version of FitVids
// Still licencened under WTFPL
//
// Not as robust and fault tolerant as the jQuery version.
// It's BYOCSS.
// And also, I don't support this at all whatsoever.
;(function(window, document, undefined) {
'use strict';
@geoffyuen
geoffyuen / wpml.sh
Created September 14, 2017 16:21
Script combines your Timber/Templates/*twig files into an index.php for WPML string translation scanning. Put this script in your templates folder and run it.
#!/bin/bash
echo "<?php">index.php ; cat *.twig >> index.php
echo "Finished!"
echo "Scan your theme: WPML, Theme and plugins localization, Scan selected themes for strings"