Skip to content

Instantly share code, notes, and snippets.

View jamigibbs's full-sized avatar

Jami Gibbs jamigibbs

View GitHub Profile
westonruter / WidgetWithBehaviorScript.widget.php
Created May 6, 2010 22:08
WidgetWithBehaviorScript: Template for a WordPress widget which enqueues an accompanying behavior script; script only output if widget is rendered.
View WidgetWithBehaviorScript.widget.php
class WidgetWithBehaviorScript extends WP_Widget {
function __construct() {
parent::__construct(__CLASS__, 'Widget with Accompanying Behavior Script', array(
'classname' => __CLASS__,
'description' => "This WordPress widget serves as a pattern for how to enqueue a script only if the widget is actually rendered."
wpscholar / functions.php
Last active March 1, 2021 13:26
Enqueueing IE conditional stylesheets in WordPress the right way
View functions.php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link
esthezia / php-sanitize-multidimensional-array.php
Created June 18, 2013 11:01
PHP - Sanitize a multidimensional array
View php-sanitize-multidimensional-array.php
* Sanitize a multidimensional array
* @uses htmlspecialchars
* @param (array)
* @return (array) the sanitized array
jbenet /
Last active January 18, 2024 09:21
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

DanHerbert /
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew


This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

krusynth /
Last active June 15, 2021 16:56
A list of useful books to improve your skills

Recommended Books

A list of useful books to improve your skills

Recommendations from others are noted in (parentheses). The rest are my personal recommendations.


Building your core

  • The Pragmatic Programmer - Hunt & Thomas
View gist:228af6f96433e6557c3f
<?php // image gallery content
if( has_shortcode( $post->post_content, 'gallery' ) ) {
// Grab the first gallery in the post
$gallery = get_post_gallery_images( $post->ID );
$image_list = '<div class="owl-carousel">';
// Loop through each image in each gallery
foreach( $gallery as $image ) {
justintadlock / customize-control-radio-image.php
Last active September 5, 2018 17:14
Customize Control: Radio Image
View customize-control-radio-image.php
* The radio image customize control extends the WP_Customize_Control class. This class allows
* developers to create a list of image radio inputs.
* Note, the `$choices` array is slightly different than normal and should be in the form of
* `array(
* $value => array( 'url' => $image_url, 'label' => $text_label ),
* $value => array( 'url' => $image_url, 'label' => $text_label ),
* )`
subfuzion /
Last active February 26, 2024 21:15
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

DaniSancas /
Created June 14, 2016 23:52
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial


Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)