Skip to content

Instantly share code, notes, and snippets.

@jasonlopez01
jasonlopez01 / Update Tableau Packaged Workbook from SQL
Last active May 3, 2021 03:06
Update Tableau Packaged Workbook from SQL
#-------------------------------------------------------------------------------
# Purpose: refresh Tableau packaged workbook file's underlying dataextract file from SQL
# Author: jasonlopez01
# Created: 05/08/2016
# Note: could also load in from csv, Excel, etc.
#-------------------------------------------------------------------------------
import pyodbc, os, shutil, datetime, zipfile, time, sys
import dataextract as tde
@cshold
cshold / supply-collection-sidebar
Last active August 20, 2021 06:47
The sidebar for Shopify's Supply theme, including code to handle an advanced tagging system.
{% comment %}
A customized sidebar for this theme. If advanced tagging is enabled in
theme settings, prepend your tags with "group" names (E.g. BRAND_) and your
collection page will create groups of tags to sort by.
Expansion of https://gist.github.com/darryn/8047749
{% endcomment %}
@lmullen
lmullen / README.md
Last active August 29, 2015 13:57
Reusable Scatter Plot Function

Learning to create a reusable chart function for a scatter plot, following Mike Bostock's "Towards Reusable Charts." Also includes a random data generator.

@DanHerbert
DanHerbert / fix-homebrew-npm.md
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

OBSOLETE

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.

@darryn
darryn / Shopify tag filter groups
Last active August 23, 2023 03:51
Create tag filter groups in Shopify. This snippet is designed to group and separate out collection tags. It requires the tags to share a common value prepended to the tag with an underscore. E.g. to create a separate tag filter group for 'brands', each product will need to be tagged with 'brand_Nike' or 'brand_Reebok'. Some of this is probably l…
{% if template contains 'collection' and collection.all_tags.size > 1 %}
<!-- A recursive loop to catch and filter out the different tag categories -->
{% assign c = 0 %}
{% for t in collection.all_tags %}
{% capture cat %}{{ cat }}{% capture temp_cat %}{% if t contains '_' %}{% assign cat_grp = t | split: '_' %}{{ cat_grp.first }}{% endif %}{% endcapture %}{% unless cat contains temp_cat %}{% if t contains '_' %}{% assign new_cat_grp = t | split: '_' %}{{ new_cat_grp.first }}{% endif %}{% unless forloop.last %}+{% endunless %}{% assign c = c | plus: 1 %}{% endunless %}{% endcapture %}
{% endfor %}
<!-- create array of tag categories -->
{% assign cat_array = cat | split: '+' %}
@addyosmani
addyosmani / examples.md
Last active February 23, 2016 18:22
Object.observe() examples from my talk

What are we trying to observe? Raw object data.

// Objects
var obj = { id: 2 };
obj.id = 3; // obj == { id: 3 }
 
// Arrays
var arr = ['foo', 'bar'];
arr.splice(1, 1, 'baz'); // arr == ['foo', 'baz'];
@typeofgraphic
typeofgraphic / mapD3JsonGeocode.html
Created January 4, 2013 23:47
Adaptation of Google Maps + D3.js Data file looks like this: [ {"country": "eth", "city": "adis abeba", "time": "2012-12-04T04:00:00", "count": 5}, {"country": "deu", "city": "munich", "time": "2012-12-04T19:00:00", "count":21}, {"country": "chn", "city": "wuhan", "time": "2012-12-04T18:00:00", "count": 1}, {"country": "usa", "city": "winthrop",…
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script>
<style type="text/css">
html, body, #map {
width: 100%;
@llad
llad / README.md
Created September 22, 2012 15:49
Reusable D3 column chart that supports negative values
@mbostock
mbostock / .block
Last active December 4, 2021 22:40
Brush & Zoom Redirect [UNLISTED]
redirect: 34f08d5e11952a80609169b7917d4172
@benjchristensen
benjchristensen / index.html
Created August 16, 2011 03:21
Animated Line Graphs / Sparklines using SVG Path and d3.js
<html>
<head>
<title>Animated Sparkline using SVG Path and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;