Skip to content

Instantly share code, notes, and snippets.

@denvers
denvers / wordpress-asset-browser-cache.php
Created April 20, 2017 08:01
Use this simple WordPress function to avoid browser cache issues after updating your CSS / JS assets. Each time you update your assets the URL will change to force browsers to re-download your asset. Yeah, dab!
<?php
// add to functions.php
/**
* cache_proof_asset_url
* @param string $asset_file (relative, eg: /css/style.css)
* @return string $asset_file_url (absolute, eg: https://www.domain.com/css/style.css?v=123456789)
*/
function cache_proof_asset_url($asset_file) {
$full_asset_url = bloginfo('stylesheet_directory') . $asset_file;
@paulirish
paulirish / gist:366184
Created April 14, 2010 18:59
html5 geolocation with fallback.
// geo-location shim
// currentely only serves lat/long
// depends on jQuery
// doublecheck the ClientLocation results because it may returning null results
;(function(geolocation){
if (geolocation) return;