Skip to content

Instantly share code, notes, and snippets.

View binarysprocket's full-sized avatar

Binary Sprocket binarysprocket

View GitHub Profile
@jaredatch
jaredatch / gist:7184603
Created October 27, 2013 16:31
A few tricks to use for your local installs
<?php
/*------------------------------------------------------------------------------
The functions below are executed if the install is declared to be a
development environment.
The following constants should be set in the install's wp-config.php:
SITE_DEV - [true/false]
SITE_PROD_URL - primary root URL of the production site
------------------------------------------------------------------------------*/
@rickrduncan
rickrduncan / genesis-page-titles-html5.php
Last active August 1, 2022 11:16
How to remove page titles from Genesis child themes using XHTML and HTML5 methods.
<?php
//* Do NOT include the opening php tag
//* ALL EXAMPLES ON THIS PAGE USE THE NEW HTML5 METHOD
//* Remove page titles site wide (posts & pages) (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
@studiopress
studiopress / large-button-followers.html
Created October 7, 2013 12:28
Twitter "Follow" Button.
<a href="https://twitter.com/bgardner" class="twitter-follow-button" data-show-count="true" data-size="large">Follow @bgardner</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
@jonschlinkert
jonschlinkert / markdown-cheatsheet.md
Last active April 11, 2024 04:45
A better markdown cheatsheet.
@jaredatch
jaredatch / gist:5640664
Created May 24, 2013 01:05
Add Author Profile Fields to User Profile
<?php
/**
* Add Author Profile Fields to User Profile
*
* @since 1.0.0
* @param object $user
*/
function ja_user_fields( $user ) {
?>
<h3>Additional Information</h3>
@jaredatch
jaredatch / gist:5640656
Created May 24, 2013 01:02
Redirect users with a certain role to a specific page after login
<?php
/**
* Redirect users with 'foo' role to a specific page after login
*
* @since 1.0.0
*/
function ja_role_login_redirect( $redirect_to, $request, $user ){
//is there a user to check?
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
if( in_array( 'foo', $user->roles ) ) {
@jaredatch
jaredatch / gist:5640639
Last active December 17, 2015 16:39
Customize the login screen text
<?php
/**
* Customize the login screen text
*
* Some sites, primarily membership sites, are setup where the usernames ARE their email address.
* This is great, but the login screen can confuse users. So help with the confusion, we remove
* all references of "Username" on the login screen and replace with "Email".
*
* @since 1.0.0
*/
@matax87
matax87 / instapapercsv_to_readinglist.py
Created May 13, 2013 14:12
Use this script to export Instapaper unread list to Safari's Reading List. Download your instapaper-export.csv from http://www.instapaper.com/u in the "Export CSV…" section on the right.
#!/usr/bin/python
import os
import csv
reader = csv.DictReader(open('./instapaper-export.csv', 'rb'), delimiter = ',', quotechar = '"')
unread = []
for row in reader:
<?php
/**
* This file adds a custom template to the AgentPress Child Theme.
*
* @author Brad Dalton
* @link http://wpsites.net/web-design/make-custom-page-template/
* @package Agentpress
* @subpackage Customizations
*/
@markjaquith
markjaquith / gist:4500280
Last active April 17, 2024 21:06
Bash command to fix a quirk with Sublime Text 2's "subl" command. Sometimes, when using it, under hard-to-pinpoint circumstances, it will open up Sublime Text 2 completely blank (i.e. the file you asked it to open will not be open). This snippet fixes that by essentially kicking subl under the table to wake it up and then passing on the command …
function subl() {
if [[ ! -p /dev/stdin ]]; then
command subl > /dev/null 2>&1
fi
command subl "$@"
}