Skip to content

Instantly share code, notes, and snippets.

View davidrleonard's full-sized avatar

David Leonard davidrleonard

View GitHub Profile
@davidrleonard
davidrleonard / eventbrite_copy_codes_snippet.js
Last active April 28, 2016 03:20
Eventbrite snippet - Copy all discount codes for event by scraping DOM
// Visit the Eventbrite discount/access code page for your event
// Expand the discount code table
// Open your JavaScript developer console and dump this code in
// Get the discount table rows
var t = $('#table_discount').find('tbody').find('tr');
// Create an array to hold the codes
var codes = new Array;
@davidrleonard
davidrleonard / csv-difference.py
Last active November 1, 2016 21:03
Compare two CSVs, output the difference between them
# Compares two CSVs and outputs a new CSV that excludes the intersection
# i.e.:
# $ python csv-difference.py -d fulldataset.csv -s subset.csv -o output.csv -u id -k id email name
import argparse
from csv import DictReader
from csv import DictWriter
def main():
parser = argparse.ArgumentParser(description='Output difference in CSVs.')
@davidrleonard
davidrleonard / gist:0d9c2d81421b4c070849
Created April 6, 2015 20:51
Public Marketing Ducksboard
https://public.ducksboard.com/ijVTcgIdKtPzVyqY0BU0/
@davidrleonard
davidrleonard / gist:0fc96dacfda6b6ad5828
Created January 7, 2015 21:28
Jekyll/Liquid: Create fake-ish hash
{% assign test-topics = 'topic-one\Topic One|topic-two\Topic Two|topic-three\Topic Three' | split: '|' %}
{% for entries in test-topics %}
{% for topic in entries %}
<!-- topic = 'topic-one\Topic One' -->
<p>First: {{ topic | split: '\' | first }}</p><!-- First: topic-one -->
<p>Second: {{ topic | split: '\' | last }}</p><!-- Second: topic-two -->
{% endfor %}
{% endfor %}
@davidrleonard
davidrleonard / gist:59ecc9f12ee596df70d5
Created January 7, 2015 20:58
Jekyll/Liquid: Iterate over array in include
{% assign similar-speakers = 'catherine-bracy|michal-migurski' | split: '|' %}
<section class="layout-semibreve">
{% for entries in similar-speakers %}
{% for speaker in entries %}
<div class="layout-minim">{% include people/{{ speaker }}.html context="speaker-card" base=".." %}</div>
{% endfor %}
{% endfor %}
@davidrleonard
davidrleonard / opendataresource
Created October 15, 2014 23:49
Open data resources
x