Skip to content

Instantly share code, notes, and snippets.

View jeremyfelt's full-sized avatar
🍕
Look at that pizza emoji!

Jeremy Felt jeremyfelt

🍕
Look at that pizza emoji!
View GitHub Profile
@jeremyfelt
jeremyfelt / wp-seo.php
Created October 5, 2012 06:34
Gist description...
add_action( 'init', 'jf_register_my_new_sitemap', 99 );
/**
* On init, run the function that will register our new sitemap as well
* as the function that will be used to generate the XML. This creates an
* action that we can hook into built around the new
* sitemap name - 'wp_seo_do_sitemap_my_new_sitemap'
*/
function jf_register_my_new_sitemap() {
global $wpseo_sitemaps;
$wpseo_sitemaps->register_sitemap( 'my_new_sitemap', 'jf_generate_my_new_sitemap' );
@jeremyfelt
jeremyfelt / test.php
Created November 28, 2012 23:29
Booligans
<?php
$x = true;
$y = false;
if ( $x && $y )
echo 'does not echo - false';
if ( $x and $y )
echo 'also does not echo - false';
@jeremyfelt
jeremyfelt / gist:4171375
Created November 29, 2012 19:45
File to be linted in PHP Storm
/*jslint browser:true */
/*global jQuery:false, swfobject:false */
@jeremyfelt
jeremyfelt / grab_url.js
Created December 3, 2012 20:38
Phantom JS Test
all_data = {
current_url : '',
current_domain : '',
page : false,
domains : [
{'url':'google.com'},
{'url':'wordpress.org'},
{'url':'wordpress.com'},
{'url':'10up.com'}
]
@jeremyfelt
jeremyfelt / apc-clear-cache.php
Created December 5, 2012 19:14
When developing locally with APC enabled, you might be inclined to clear cache forecefully lest you go crazy.
<?php
apc_clear_cache();
apc_clear_cache( 'user' );
apc_clear_cache( 'opcode' );
@jeremyfelt
jeremyfelt / test.js
Created December 7, 2012 00:17
My first self executing function... :)
(function (window, $) {
"use strict";
var document = window.document;
$(document).ready(function () {
$('.open-customer-service').children('a[href="#"]').click(function (e) {
e.preventDefault(); // stop the link from taking us back to #
$('#customer-service-modal').show();
window.scrollTo(0, 0);
});
@jeremyfelt
jeremyfelt / gist:4230934
Created December 7, 2012 05:06
Predeploy Deploys
fys_predeploy() {
rsync -rv --delete --exclude '.git' --exclude '/content/uploads/2011' /srv/www/feedyourskull.com/* ~/staging/feedyourskull.com/
cd ~/staging/feedyourskull.com/
git status
}
fys_deploy() {
sudo rsync -rv --delete --exclude '.git' --exclude 'content/uploads' ~/staging/feedyourskull.com/* /srv/www/feedyourskull.com/
cd /srv/www
sudo chown -R www-data:www-data feedyourskull.com/
@jeremyfelt
jeremyfelt / is-page-for-posts.php
Created December 15, 2012 23:37
is_page_for_posts() conditional
<?php
/**
* If you have a static page set for posts and want to conditionally load
* something for it, things seem tricky.
*
* is_post_type_archive( 'post' ) will return false, because it thinks it's a page
* is_home() will return true on the 'blog' page, but false on category archives
* is_archive() will return true as expected, but also returns true for other post types
*
@jeremyfelt
jeremyfelt / state-select.html
Created December 30, 2012 19:36
State names as options in a select list formatted 3 ways
<!-- Full state name as option value -->
<select id="state-select-list" name="state_full_name">
<option value="alabama">Alabama</option>
<option value="alaska">Alaska</option>
<option value="arizona">Arizona</option>
<option value="arkansas">Arkansas</option>
<option value="california">California</option>
<option value="colorado">Colorado</option>
<option value="connecticut">Connecticut</option>
<option value="delaware">Delaware</option>