Skip to content

Instantly share code, notes, and snippets.

View figureone's full-sized avatar

Paul Ryan figureone

  • University of Hawaii
  • Oahu, Hawaii
View GitHub Profile
@figureone
figureone / whatisslow-extended.php
Created October 16, 2018 01:44
Profile WordPress hooks (action or filter) and log any taking more than 0.5 seconds
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
* @version 0.4
@figureone
figureone / gist:43661c51d992d89e56e1
Created May 6, 2015 20:01
Extend WordPress TinyMCE plugin wplink.js to include a checkbox that adds a "required" class when checked.
diff --git a/lib/wplink-required/wplink-required.js b/lib/wplink-required/wplink-required.js
new file mode 100644
index 0000000..af440b2
--- /dev/null
+++ b/lib/wplink-required/wplink-required.js
@@ -0,0 +1,115 @@
+( function ( $ ) {
+ $( document ).ready( function () {
+ // Global: wpLink.
+
@figureone
figureone / gist:4238427
Created December 8, 2012 03:19
WordPress: print link to next page
<?php
$allPages = get_pages(array(
'sort_column' => 'menu_order',
'sort_order' => 'asc',
));
for ($i=0; $i<count($allPages); $i++) // advance iterator to current page
if ($allPages[$i]->ID == $post->ID)
break;
$nextURI = $i<count($allPages)-1 ? get_permalink($allPages[$i+1]->ID) : "";
$nextTitle = strlen($nextURI)>0 ? $allPages[$i+1]->post_title : "";
@figureone
figureone / gist:4211549
Created December 5, 2012 02:20
Retrieves publications stored in LDAP via API
<?php global $user; ?>
<h2>Academics Productivity Summary</h2>
<p>Hello, <?php print $user->name; ?>. Here are your publications we have on record:</p>
<?php
$api_url = "http://os-133-7/reportserverapi/reports/PublicationsByPerson.php?outputType=JSON&person=evaponte&pubType=Journal%20Article";
$api_response = file_get_contents($api_url);
$api_response_json = json_decode($api_response);
paul@webdev:/var/www/coe-external/sites/all/themes/zen_coe$ git diff js/script.js
diff --git a/js/script.js b/js/script.js
index 905f635..be1078c 100644
--- a/js/script.js
+++ b/js/script.js
@@ -403,7 +403,10 @@ jQuery(function($) {
// JKH 08152012 - Disable top level links in horizontal menu for touch devices
if (Modernizr.touch){
- $("#navigation ul.menu > li > a").removeAttr('href');