Skip to content

Instantly share code, notes, and snippets.

View anthonycole's full-sized avatar
🏠
Working from home

Anthony Cole anthonycole

🏠
Working from home
View GitHub Profile
@anthonycole
anthonycole / gist:7922084
Last active December 31, 2015 02:39
Playing with Backbone routes - navigate to a specified main anchor
var GalleryRouter = Backbone.Router.extend ({
routes: {
'*actions': function(action) {
id = '#' + action;
jQuery(document).ready(function($) {
$("html, body").animate({ scrollTop: $(id).offset().top -150 }, 1000);
});
}
}
});
@anthonycole
anthonycole / region.page.coffee
Created September 3, 2013 08:00
Having issues binding an event to some markup that's been loaded. Might be something to do with being a bit noobbish at JS
class RegionPage extends Region
init : ->
# elements
@$playlistAside = @$el.find('#playlists-aside')
@$playlistAsideItem = @$playlistAside.find('p')
# events
@events.on 'page.toggleAside', => @toggleAside()

Old Fashioned

Background

I've just started a new job at an agency and I've been looking around at different starter themes for WordPress. I need something that works for me and effectively allows me to cut down on my dev time and does things that I would normally do anyways.

What I'm thinking of doing

@anthonycole
anthonycole / mixins-fontface.less
Created August 15, 2013 05:23
A quick mixin example for font-face and less.
/*
This should be put in your mixins.less file.
*/
.font-face(@fontname)
{
font-family: "@{fontname}";
src: url("/assets/fonts/@{fontfile}.eot");
src: url("/assets/fonts/@{fontpath}/@{fontfile}.eot?#iefix") format("embedded-opentype"),
url("/assets/fonts/@{fontfile}.woff") format("woff"),
@anthonycole
anthonycole / datefail.php
Created July 27, 2013 07:00
#doesntwork
<?php
$year = date("Y");
// if the curret time is after november 31 but before the 31st of march, eot = 31st of march
$decemberstart = strtotime("1 December " + $year);
$marchend = strtotime("31 March " + $year);
// if the current time is after 1 april but before 31 july, eot = 31 july
$aprilstart = strtotime("1 April " + $year);
@anthonycole
anthonycole / gist:5711755
Last active December 18, 2015 02:29
Add a class to every page that isn't a homepage in WordPress.
<?php
// put this in your functions.php file.
add_filter('body_class', 'five15_body_classes');
function five15_body_classes($classes) {
if( !is_front_page() )
$classes[] = 'not-home';
@anthonycole
anthonycole / wp-maybellene.php
Last active December 15, 2015 16:19
A simple "tracker" for seeing what WordPress posts a user looks at.
<?php
/*
Plugin Name: Maybelline
Author: Anthony Cole
Author URI: http://anthonycole.me/
*/
/**
* WP_Maybelline
*
@anthonycole
anthonycole / slider_custom_post_type.php
Created October 17, 2012 01:50 — forked from BronsonQuick/slider_custom_post_type.php
The backend for a Slider Custom Post Type which uses extra meta boxes and a wp_editor API for one of those boxes
<?php
/*
Plugin Name: Learning Seat Homepage Slider Custom Post Type
Plugin URI: http://www.sennza.com.au
Description: Custom Post Type to populate slider on the homepage
Version: 1.0
Author: Bronson Quick
Author URI: http://www.sennza.com.au
License: GPL2
*/
@anthonycole
anthonycole / acf-georss.php
Created September 3, 2012 07:18 — forked from anonymous/acf-georss.php
GeoRSS Support for the location extension of Advanced Custom Fields. Work in progress.
<?php
/*
Plugin Name: GeoRSS ACF Extension
Author: Anthony Cole
Author URI: http://anthonycole.me/
Description: Extends ACF Locations extension to allow plotting multiple locations on a map with GeoRSS
Version: 0.5
*/
class GeoRSS_Map {
@anthonycole
anthonycole / gist:1325539
Created October 30, 2011 05:19
WordCamp Gold Coast Sample Plugin
<?php
/**
* Appends content to WordPress content
*
* @return var $new_content
* @author Anthony Cole
**/
function wcgold_modify_content( $content ) {
$string = ' and WordCamp Gold Coast is Awesome!';