Skip to content

Instantly share code, notes, and snippets.

View joliesky's full-sized avatar

Jolie McCullough joliesky

  • New York Times
  • Austin, TX
View GitHub Profile
@joliesky
joliesky / d3map.js
Created August 11, 2015 19:01
Container width test on d3 map
/* global pym, d3, topojson */
(function() {
'use strict';
var pymChild;
function render(containerWidth) {
d3.selectAll('svg').remove();
@joliesky
joliesky / BarChartCSS.css
Last active August 29, 2015 14:21
Bar chart w/ CSS only
.bar-chart {
margin-right: 1.5em;
.city {
position: relative;
margin-top: 0.5em;
.bar-label {
text-align: right;
width: 135px;
margin: 0.15em 0;
float: left;
@joliesky
joliesky / CategoryOrSub
Last active December 21, 2015 09:09
Wordpress - Ability to get category and all sub-categories
/*
Snippet Name: Category or Subcategory
Description: Gets the category and all subcategories of a cat_ID
Usage: Ideal if you are trying to put code only on the categories of a cat and it's children, in lieu of doing an array of all the children. Put the following code in functions.php or a plugin.
*/
<?php if (!function_exists('is_category_or_sub')) {
function is_category_or_sub($cat_id = 0) {
foreach (get_the_category() as $cat) {
if ($cat_id == $cat->cat_ID || cat_is_ancestor_of($cat_id, $cat))
return true;