Skip to content

Instantly share code, notes, and snippets.

@seamusleahy
seamusleahy / Retro
Last active December 10, 2015 21:39
Fancy Effects with WP.com's Proton API http://developer.wordpress.com/docs/photon/api/
?colorize=40,10,-40&contrast=2
?colorize=30,10,-40&contrast=5&brightness=-40
?colorize=10,10,-20&contrast=5&brightness=-10
?colorize=10,10,-20&contrast=5&brightness=15
?colorize=-20,10,20&contrast=5&brightness=-30
?colorize=-20,10,20&contrast=5&brightness=-30&filter=blurgaussian
@seamusleahy
seamusleahy / functions.php
Created September 11, 2012 17:08
Simply add AJAX callbacks to your WordPress Theme
<?php
/**
* 1. Add this to your theme's functions.php file.
* 2. Create an 'ajax' folder in your theme directory.
* 3. Create a PHP file to handle the AJAX call in the ajax folder.
* 4. From Javascript, make an AJAX call using jQuery:
* 5. $.get( window.themeSettings.ajaxUrl, {action: window.themeSettings.themeAjaxAction, template: 'YOUR TEMPLATE NAME (MINUS THE .php EXTENSION)'}, function( data ) { } );
*/
@seamusleahy
seamusleahy / get_postmeta_tuples.php
Created September 11, 2012 17:00
A utility function for WordPress to retrieve metadata from post to display in a list or drop-down
<?php
/**
* Retrive the tuples of metadata in a given set of post-types.
*
* @param $metakeys string|array - The metakeys to be the tuple elements
* @param $post_types string|array optional - The post-types to limit the query on. Defaults to the current post-type
*
* <?php
* $cities = get_postmeta_tuples( array( 'city', 'state' ), 'chapters' );
* ?>
@seamusleahy
seamusleahy / gist:3098949
Created July 12, 2012 15:46
Create a curve to text using Lettering.js, Sass, and Compass
/* Add a wave alignment to your title text using Sass, Compass, and Lettering.js.
*
* Lettering.js wraps each letter with a span with a class of .char<#>.
* Compass provides math functions including the sin which provides the wave form.
*/
$length: 11; // The word is 11 letters long
@for $i from 1 through $length {
.char#{$i} {
@include transform(translateY( sin(($i - 1)/($length - 1)*2*pi()) * -25px) );
@seamusleahy
seamusleahy / gist:2028532
Created March 13, 2012 12:41
Adding mobile-only show/hide toggle button to your navigation with Twitter Bootstrap
<!-- I noticed that Twitter Bootstrap has a feature to make your navigation work on mobile.
It just appears that the documentation is missing for it.
Take the navigation bar and then add a toggle button and wrap the navigation list in '.nav-collapse'.
-->
<nav class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<!-- Add toggle button -->
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
@seamusleahy
seamusleahy / NextGEN echo gallery pictures
Created February 7, 2011 19:23
Output a list of the images in a NextGEN gallery