Skip to content

Instantly share code, notes, and snippets.

View rmadsen's full-sized avatar

Ryan Madsen rmadsen

View GitHub Profile
@rmadsen
rmadsen / PubsubRedux.md
Last active April 5, 2017 13:53
Proposal for a redux-like pub-sub store

Note: I realize the below is fairly abstract, and would be happy to come up with some pseudo code if that would make things clearer. I'm still in the process of trying to piece together my thoughts. Thanks in advance for reading and for the feedback!

I have two motivations for creating a pub-sub variant of Redux, which I'll get to in a minute. I first want to describe what I mean by a "pub-sub redux variant." I'm enamored with redux's action/reducer model, but feel like there is an unnecessary limitation where components can only be connected to the root of the store state. What I'd like to propose is that instead of react-redux's mapStateToProps function, connect expects a collection of subscriptions. Each subscription is an object of the form { pathToSubscribeTo, stateToPropsHandlerFn }, where pathToSubscribeTo is a pointer/string representing a node in the state tree, and stateToPropsHandlerFn is a function that takes the updated node and returns some props that should be passed to the under

@rmadsen
rmadsen / README.md
Last active December 2, 2015 22:54 — forked from mbostock/.block
Every ColorBrewer Scale [Clickable]

A quick visual reference to every ColorBrewer scale; colors by Cynthia Brewer. Available in CSS and JS format. Click on a palette to log the constituent colors in hexadecimal RGB to the console.

This fork shows all variants of the scheme on click.

@rmadsen
rmadsen / README.md
Last active January 20, 2016 23:08 — forked from mbostock/.block
Horizon Chart

Description

Horizon charts combine position and color to reduce vertical space. Start with a standard area chart, then mirror negative values (in blue) or offset them vertically. Click the + button above to increase the number of bands, turning the area into a horizon.

Implemented with the d3.horizon plugin.

This fork allows users to play around with different interpolation functions dynamically.

Demo

Click here

@rmadsen
rmadsen / eossdk_utils.py
Created October 20, 2015 19:12
A utility debugging class for EOS SDK python agents.
#!/usr/bin/env python
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
from functools import wraps
import pdb
import sys
import traceback
import types
@rmadsen
rmadsen / eossdk_utils.py
Created August 14, 2015 18:09
EOS SDK python debug helper
#!/usr/bin/env python
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
from functools import wraps
import pdb
import sys
import traceback
import types
@rmadsen
rmadsen / Arista_eAPI_ACL_editor.py
Last active July 28, 2022 08:26
EAPI script to remotely edit an access list across multiple switches using your editor of choice
#!/usr/bin/env python
# Copyright (c) 2014 Arista Networks
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#