Skip to content

Instantly share code, notes, and snippets.

View sta1r's full-sized avatar

Alastair Mucklow sta1r

  • Dotdigital
  • Winchester
View GitHub Profile
@sta1r
sta1r / feed-georss.php
Created March 3, 2011 15:34
A geoRSS-formatted feed template for Wordpress
<?php
/*
GeoRSS formatted output for Google Maps
Authors: Alastair Mucklow, Chris Toppon
*/
//header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
//$more = 1;
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'" standalone="yes"?'.'>'; ?>
@sta1r
sta1r / showtime-json-tooltip
Last active October 6, 2015 22:17
Showtime JSON reader script
// Showtime JSON loader
if ($('#showtime-json').length){
var feedUrl = $('#showtime-json').data('url');
var limit = $('#showtime-json').data('limit');
$.getJSON( feedUrl + '&limit=' + limit + '&callback=?', function(data) {
$('.loader').hide();
var container = $('#showtime-json');
var outputNode = container.find('ul');
@sta1r
sta1r / utilities.scss
Last active October 7, 2015 01:17
A more useful utilities sass file for inclusion in projects.
// UTILITY CLASSES
// ---------------
// Positioning
.relative {
position: relative;
}
.affix {
position: fixed;
}
@sta1r
sta1r / wp-strip-css-js
Created July 18, 2012 16:57
Removing Wordpress plugin scripts and styles
/* Remove plugin CSS & JS */
/* Next Gen Gallery */
function dequeue_nextGen_style() {
wp_dequeue_style('NextGEN');
}
add_action('template_redirect', 'dequeue_nextGen_style');
function dequeue_nextGen_js() {
if (!is_singular()) {
@sta1r
sta1r / geoIP-message.php
Created November 15, 2012 14:23
GeoIP detection + conditional messaging
<?php
include($_SERVER['DOCUMENT_ROOT'].'GeoIP.inc');
$gi = geoip_open($_SERVER['DOCUMENT_ROOT'].'country.dat', GEOIP_STANDARD); // not recommended, better for server to query maintained file
$country = geoip_country_code_by_addr($gi,$_SERVER['REMOTE_ADDR']);
if (( $country == "IE")) { ?>
<h2>Welcome Irish visitors</h2>
<?php } else if (($country == "US")) { ?>
<h2>Welcome American visitors</h2>
@sta1r
sta1r / Zenphoto .htaccess CSS versioning
Created December 21, 2012 15:22
Zenphoto .htaccess with CSS versioning redirection
RewriteEngine On
RewriteBase /
# Redirection for CSS versioning
RewriteRule ^(.*)\.[\d]{10}\.(css|js)$ $1.$2 [L]
switch (e.which || e.keyCode) {
case 71:
var gw = document.getElementById('gridsetoverlaywrap');
if (!gw) gs.show();
else gs.remove(gw);
gs.prevent(e);
break;
@sta1r
sta1r / gist:5553189
Last active December 17, 2015 04:49
Box-out
<div class="box-out bg-gray-bg">
<h3>Critical time-sensitive</h3>
<p><a href="#">We're running to the quad! We're streaking!</a></p>
</div>
@sta1r
sta1r / gist:5568186
Last active December 17, 2015 06:49
UAL Build: Three-Up blocks
<ul class="blocks three-up">
<li>
<div class="media-block region heading-bottom">
<figure>
<a href="#" title="Link title">
<img src="http://placehold.it/290x290" alt="Image Alt">
</a>
</figure>
</div>
</li>
@sta1r
sta1r / gist:5568377
Created May 13, 2013 13:42
UAL Build: Four-Up blocks
<ul class="blocks four-up">
<li>
<div class="media-block region heading-top">
<h2 class="media-heading-top">Media Heading</h2>
<figure>
<a href="#" title="Link title">
<img src="http://placehold.it/258x212" alt="Image Alt">
</a>
<figcaption>Curabitur blandit tempus porttitor, Odio. Original by <a href="#">Lorem Ipsum</a></figcaption>
</figure>