This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
//Set-up some constants. | |
var scrollTimeout; | |
var scrollUsePushStateInstead = false; //Set to true to make the history stack of the browser include every point when posts were loaded. It's kind of annoying. | |
var scrollDelay = 200; //Milliseconds | |
var scrollLoading = false; | |
var triggerOffset = $(document).height() - $('article').eq(-4).offset().top; //The point of this is to do one calculation up front instead of multiple calculations every time the infinite scroll is triggered. | |
// Simple feature detection for History Management (borrowed from Modernizr) | |
function supportsHistory() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function goddard_breadcrumbs( $post_id = FALSE ) { | |
global $post; | |
if( $post_id ) { | |
$post = get_post( $post_id ); | |
} | |
if( !$post && !is_404() && !is_search() ) { | |
return false; | |
} | |
$crumbs = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rh_404_overrides() { | |
global $wp_query, $wpdb; | |
if( $wp_query->is_404 && isset( $wp_query->query_vars['pagename'] ) && !empty( $wp_query->query_vars['pagename'] ) ) { | |
$query = "SELECT `ID` FROM `" . $wpdb->posts . "` WHERE `guid` LIKE '%" . $wp_query->query_vars['pagename'] . "%' LIMIT 0,1;"; | |
$post_id = intval( $wpdb->get_var( $query ) ); | |
if( $url = get_permalink( $post_id ) ) { | |
wp_redirect( $url, 301 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var del = require('del'); | |
gulp.task('clean:min-css', function () { | |
// Delete all *.min.css files in the CSS directory so we don't get duplicates | |
return del([ | |
'css/*.min.css' | |
]); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate a Markdown change log of pull requests from commits between two tags | |
# Author: Russell Heimlich | |
# URL: https://gist.github.com/kingkool68/09a201a35c83e43af08fcbacee5c315a | |
# HOW TO USE | |
# Copy this script to a directory under Git version control | |
# Make the script executable i.e. chmod +x changelog.sh | |
# Run it! ./changelog.sh | |
# Check CHANGELOG.md to see your results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "your-github-name/your-repo", | |
"license": "GPLv3", | |
"minimum-stability": "dev", | |
"prefer-stable": true, | |
"authors": [ | |
{ | |
"name": "Your Name", | |
"email": "[email protected]" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This script will parse our Slack history and pull email subscriber counts that were posted by our bots. | |
* Place in the root of a WordPress install, add a Slack token for API access, and visit the URL | |
* | |
* A CSV file of the results will be downloaded. | |
* For further analys import into a database (See Below) | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'simple_html_dom.php'; | |
$html = file_get_html('http://www.asia.si.edu/exhibitions/past.asp'); | |
$output = array(); | |
foreach( $html->find( '#filterarea li' ) as $elem ) { | |
$h1 = $elem->find( 'h1', 0 ); | |
if ( $h1 ) { | |
continue; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array(...); | |
$my_posts = new WP_Query( $args ); | |
$the_year = ''; | |
$the_month = ''; | |
if ( $my_posts->have_posts() ) : | |
while ( $my_posts->have_posts() ) : | |
$my_posts->the_post(); | |
// Get the year of the post in YYYY format | |
$post_year = get_the_time( 'Y' ); |