Skip to content

Instantly share code, notes, and snippets.

View cmcculloh's full-sized avatar

Christopher McCulloh cmcculloh

View GitHub Profile
@cmcculloh
cmcculloh / gist:3719497
Created September 14, 2012 02:43
refactored slider code
//SPOTLIGHT SLIDER LAYOUT 3
jQuery("#slider3 > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", <?php echo $con_spotlight_duration; ?>000, false);
var rotateHoverHandler = {
hoveredOver: false,
stopSlider: false,
isRotating: true,
hoverOver: function(){
jQuery("#slider3 > ul").tabs("rotate", null, false);
@cmcculloh
cmcculloh / gist:3143923
Created July 19, 2012 13:31 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@cmcculloh
cmcculloh / dynodeGetBatchItem.js
Created April 26, 2012 20:26
dynode getBatchItem example
var events = {
options: null,
getEventsList: function(){
console.log('events.getEvents() private: got here');
var opts = {
Limit: 15
};
dynode.query("event_types_timestamp", "Viewed Product", opts, events.getEventDetails);
},
@cmcculloh
cmcculloh / linkbait.md
Last active October 2, 2015 16:29
Top 28 strategies for perfect link bait git commit comments, first you'll be skeptical, then you'll be inspired.

Writing git commit comments is boring. Following this guide will make it easy to make it much more fun. Inspired by this comic, Clickbait Headline Generator and this article used as a reference.

  1. The List
    Good for fixes that required a number of discrete methods to fix something
    • "10 antipaterns everyone knows are actually just lies"
    • "5 weird ways spinbox changed in just 2 weeks, the 4th will leave you speachless."
  2. Case Studies
    Perfect for unit test commit comments (you can even use the GH Issue number as the case study number)
    • "Case Study #1543: Does spinbox still allow exceeding maximum through manual input?"
    • `"Case Study #24: Does repeater still
@cmcculloh
cmcculloh / gist:1585261
Created January 9, 2012 22:15
weird new script behaviour
master
$ new menu
####################################################################################
Creating new branch: `menu`
####################################################################################
@cmcculloh
cmcculloh / gist:1585461
Created January 9, 2012 22:55
weird push behaviour
$ commit "got the array passing to work (finally, OMG this was ridiculous)" -a
####################################################################################
Committing changes to branch: `menu`
####################################################################################
Checking status...
------------------------------------------------------------------------------------
$ git status
@cmcculloh
cmcculloh / wpphpbbbridgefix
Created December 30, 2011 04:35
Fix for WP phpBB Bridge Warning: mysql_set_charset() expects parameter 2 to be resource, boolean given in wpbb_topics_widget.php on line 149
//all of this replaces line 147 (NOT 149!!)
$db_conn_uri = $dbhost;
if(isset($dbport) && !empty($dbport)){
$db_conn_uri .= ":" . $dbport;//could be improved by adding a check to make sure that $dbport doesn't start with ":" before tagging that on for them
}
$cn = @mysql_pconnect($db_conn_uri, $dbuser, $dbpasswd);
@cmcculloh
cmcculloh / gist:1387990
Created November 23, 2011 05:58
register fields
//you can have as many of these as you want...
your_prefix_register_field('field_id', 'field label', 'dashboard page', 'section_id', array('callback', 'params', 'can', 'go', 'here'));
your_prefix_register_field('field_id2', 'field label', 'dashboard page', 'section_id');
your_prefix_register_field('field_id3', 'field label', 'dashboard page', 'section_id');
your_prefix_register_field('field_ida', 'field label', 'dashboard page', 'section_id');
your_prefix_register_field('field_idz', 'field label', 'dashboard page', 'section_id');
@cmcculloh
cmcculloh / gist:1387983
Created November 23, 2011 05:55
global callback
function your_global_callback($field){
$selected = get_option($field["id"]);
if($field["type"] == "text"){
?>
<input type="text" name="<?php echo $field["id"]; ?>" id="<?php echo $field["id"]; ?>" value="<?php echo $selected ?>">
<?php
}else if($field["type"] == "checkbox"){
if($selected){
$selText = ' checked="checked" ';
@cmcculloh
cmcculloh / gist:1387980
Created November 23, 2011 05:53
section callback
function your_prefix_your_section_callback_function(){
settings_fields('your_settings_group');//make hidden fields print out in form
echo "<p>Stuff for the user here</p>";
}