Skip to content

Instantly share code, notes, and snippets.

View paulgosnell's full-sized avatar

Paul paulgosnell

View GitHub Profile
Verifying my Blockstack ID is secured with the address 1BqB1QvULBeZxeV1gGnFZ2HiquviGgMWBN https://explorer.blockstack.org/address/1BqB1QvULBeZxeV1gGnFZ2HiquviGgMWBN
Verifying that +paulgosnell is my blockchain ID. https://onename.com/paulgosnell
<?php
/**
* Is the current page a descendent of page identified by the path (not slug).
* A page is not a descendent of itself!
* @link http://wordpress.stackexchange.com/questions/101213/does-is-child-exist-in-wp-3-5-1
* @param string $page_path The path of the page, e.g. mypage/mysubpage
* @return boolean True if current page is a descednent of specified $page_path. False otherwise.
*/
function is_descendent_of( $page_path ){
@paulgosnell
paulgosnell / featured image URL
Created December 20, 2013 14:21
get featured image URL
<?php /*
Name: Social Media Icons Template Part
Description: Add Facebook, Twitter, Google+ and LinkedIn sharing to your template files with this easy to adapt tempate-part
Author: Piet Bos
Author URI: http://wpti.ps
Instructions: Step 1. Take the code from line 10-36 of this file, paste them into a blank file, save that file as icons-social.php and upload it to your theme's directory. On lines 19 and 21 you need to fill in your Twitter username and on line 24 you need to upload your favourite tweet-button (or grab it from http://a2.twimg.com/a/1319826270/images/goodies/tweetn.png) to the images folder of your theme. Step 2. Take line 39 of this file and paste it into your template files on the place where you want the icons to show up. Step 3. Take the scripts of line 42-49 and paste them in your footer.php file just above the closing </body> tag. Step 4. Style through CSS. NOTE that with the code below you will get 4 working share buttons. If you however want to make adjustments then visit the following pa
@paulgosnell
paulgosnell / jQuery.support-transition.js
Created June 18, 2012 13:42 — forked from jonraasch/jQuery.support-transition.js
Extends the jQuery.support object to CSS3 transition
// jQuery.support.transition
// to verify that CSS3 transition is supported (or any of its browser-specific implementations)
$.support.transition = (function(){
var thisBody = document.body || document.documentElement,
thisStyle = thisBody.style,
support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined;
return support;
})();
function load() {
if (navigator.userAgent.match(/OS 5(_\d)+ like Mac OS X/i)) { document.body.className+=" ios5" }
}
@paulgosnell
paulgosnell / quotaexceeded.js
Created May 3, 2012 08:25 — forked from akgupta/quotaexceeded.js
handle quota exceeded error in local storage
try {
module.$localStorage[key] = serializer(value);
} catch(e) {
if(e.name === 'QUOTA_EXCEEDED_ERR') {
// reset to make space
module.reset();
module.$localStorage[key] = serializer(value);
} else {
module.localStorageAvailable = false;
$log.error("Local storage write failure - " + e);
@paulgosnell
paulgosnell / localStorageSync.js
Created May 3, 2012 08:23 — forked from akgupta/localStorageSync.js
Overriding backbone sync to use local storage
// overriding sync to use local storage when possible
sync : function(method, model, options){
var key, now, timestamp, refresh;
if(method === 'read' && this.constants.isStoredInLocalStorage) {
// only override sync if it is a fetch('read') request
key = this.getKey();
if(key) {
now = new Date().getTime();
timestamp = $storage.get(key + ":timestamp");
refresh = options.forceRefresh;
@paulgosnell
paulgosnell / snippet.js
Created April 11, 2012 09:11 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],