Skip to content

Instantly share code, notes, and snippets.


Clark Wimberly clarklab

View GitHub Profile
clarklab / transient-example.php
Created Jan 30, 2013
Caching a simple API call using the WP Transient API
View transient-example.php
//let's get some tweets!!
//first, let's see if I've got the data already cached
$tweets = get_transient("tweets");
//dang it! it looks like I might not. let's grab some tweets from the Twitter API
if( !$tweets ) {
clarklab / waypoint-custom.js
Created Jan 10, 2013
simple jquery waypoint up/down toggle
View waypoint-custom.js
$('.section').waypoint(function(event, direction) {
if (direction === 'down') {
} else {
clarklab / gist:4036164
Created Nov 8, 2012
mklink (creating a symlink in Windows)
View gist:4036164
mklink /d "C:\Users\clark\AppData\Roaming\Sublime Text 2\Packages\User" "C:\Users\clark\Dropbox\Sublime\Packages\User"
clarklab / package control
Created Nov 7, 2012
Sublime Text Package Control installation command
View package control
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen(''+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
View zencoding.html
<!-- the following shorthand -->
<!-- expands into this clean markup-->
<html lang="en-US">
<meta charset="UTF-8">
clarklab / sftp-config.json
Created Nov 7, 2012
Sample Sublime SFTP config
View sftp-config.json
// The tab key will cycle through the settings when first created
// Visit for help
// sftp, ftp or ftps
"type": "sftp",
"save_before_upload": true,
"upload_on_save": false,
"sync_down_on_open": false,
clarklab / enqueue_script_conditional.php
Created Nov 5, 2012
WordPress conditional JS enqueue
View enqueue_script_conditional.php
if (is_page('Contact')) {
wp_register_script( 'contact-form', '');
wp_enqueue_script( 'contact-form' );
clarklab / set_page_template.php
Created Nov 5, 2012
set a page template programmatically in WordPress
View set_page_template.php
update_post_meta( $post_id, '_wp_page_template', 'page-contact.php' );
clarklab / wp_query_php_enclosure.sublime-snippet
Created Oct 29, 2012
WP_Query snippet (with php enclosures) for Sublime Text 2
View wp_query_php_enclosure.sublime-snippet
<?php \$${1:query} = new WP_Query('${3:posts_per_page=5}'); ?>
<?php while (\$${1:query}->have_posts()) : \$${1:query}->the_post(); ?>
${3:// do something}
<?php endwhile; ?>
<description>WP_Query with php enclosures</description>
clarklab / wp_query.sublime-snippet
Created Oct 29, 2012
WP_Query snippet for Sublime Text 2
View wp_query.sublime-snippet
\$${1:query} = new WP_Query('${2:posts_per_page=5}');
while (\$${1:query}->have_posts()) : \$${1:query}->the_post();
${3:// do something}
<description>WP_Query basic loop</description>
You can’t perform that action at this time.