Skip to content

Instantly share code, notes, and snippets.

View brittanydionigi's full-sized avatar

Brittany Dionigi brittanydionigi

View GitHub Profile
@brittanydionigi
brittanydionigi / shifts.js
Created March 27, 2014 21:12
making people do my work for me
/* Some boys are playing a hockey game and they each play a certain number of shifts. */
/* For simplicity, we'll say there are 15 different shifts in a game. */
[
{
"player": "Joe",
"shifts": [
{ "shift_start": 3, "shift_end": 5 }, // Joe started playing at shift #3, and stopped after shift #5
{ "shift_start": 7, "shift_end": 11 }
]
@brittanydionigi
brittanydionigi / update.html
Created February 10, 2014 23:24
lazy-load images for Smith
<img
data-original="//cdn.shopify.com/s/files/1/0202/8216/products/SWORDSSMITH-KILLER-quillearring500x750_large.jpg?v=1379114870"
class="lazy"
style="display: inline;">
<script type="text/javascript">
(function() {
$('img.lazy').lazyload({
@brittanydionigi
brittanydionigi / what-on-earth.js
Last active January 4, 2016 20:50
nothing's right I'm torn I'm all out of faith this is how I feel I'm cold and I am shamed
points_to_award: function(questionPosition, inputVal, correctVal) {
var points_earned, plus_seven, plus_three, plus_one;
switch (questionPosition) {
case 2:
plus_one = (inputVal >= (correctVal - 5) && inputVal <= (correctVal + 5)) ? 1 : 0
plus_three = (inputVal >= (correctVal - 3) && inputVal <= (correctVal + 3)) ? 3 : plus_one;
break;
case 10:
plus_one = (inputVal >= (correctVal - 3) && inputVal <= (correctVal + 3)) ? 1 : 0
/*
* Helper function for getting query string parameters
* @param {string} name The name of the query parameter we want the value of
* @return {string} results Value of the query parameter
*/
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
@brittanydionigi
brittanydionigi / responsive-background-colors.css
Created January 28, 2014 01:44
responsive CSS template for development
/* RED 1024 */
@media only screen and (max-width: 1024px) {
body { background-color: rgba(255, 0, 0, 0.5); }
}
/* ORANGE 972 */
@media only screen and (max-width: 972px) {
body { background-color: rgba(255, 165, 0, 0.5); }
}
@brittanydionigi
brittanydionigi / D3-Line-Chart-Plotting-Shot-Attempts.markdown
Last active January 1, 2016 16:58
codepen to gist. it's amazing.

D3 Line Chart Plotting Shot Attempts

D3 line chart plotting shot attempts for an NHL hockey game. Different point styling for goals vs. shots, tooltip on hover & additional details show on click. Optional strength chart toggle which underlays 5v4, 4v5 and 5v5 events during the game.

A Pen by Brittany Storoz on CodePen.

License.

@brittanydionigi
brittanydionigi / strength.py
Last active January 1, 2016 14:19
get play-by-play event strength
def get_strength_transitions(teams, events):
strength = [{"start_time": 0, "advantage": None }]
originalAdvantage = None
for ind, event in enumerate(events):
if len(event["strength"]) == 2:
timeExpired = parseGameTime(event["total_time_expired"])
eventStrength = event["strength"]
teamAdvantage = None
@brittanydionigi
brittanydionigi / custom.css
Created December 15, 2013 17:34
devtools sooo cute!!
/*****************************************************************************/
/* Zero-Dark-Matrix
/* Optimized for Chrome Dev/Canary Channel v31
/* https://github.com/mauricecruz/chrome-devtools-zerodarkmatrix-theme
/*************************************************************************/
/**********************************************
/* Readability
/* -------------------------------------------
/* Adjust the line height for elements|sources
@brittanydionigi
brittanydionigi / document-fragments.js
Last active December 24, 2015 06:09
over-engineering document fragments to death
/*
* Helper function for creating document fragments
* @param {object} node The DOM node we are creating
* @param {string} txt The text, if any, that we want directly inside of our DOM node
* @param {object} nodeAttrs A hash of any attributes we want to set on the DOM node (e.g. className, id, href, etc.)
* @param {array} childNodes An array of any child elements we want to insert within our DOM node
* @return {object} elem The DOM element we've built with appropriate text and child nodes
*/
constructElem = function(node, txt, nodeAttrs, childNodes) {
var elem = node;
@brittanydionigi
brittanydionigi / .hashrc
Last active December 20, 2015 09:09
git aliases
# forked from: https://github.com/hashrocket/dotmatrix/blob/master/.hashrc
# git_prompt_info accepts 0 or 1 arguments (i.e., format string)
# returns text to add to bash PS1 prompt (includes branch name)
git_prompt_info () {
local g="$(git rev-parse --git-dir 2>/dev/null)"
if [ -n "$g" ]; then
local r
local b
local d