Skip to content

Instantly share code, notes, and snippets.

View neurosnap's full-sized avatar

Eric Bower neurosnap

View GitHub Profile
@neurosnap
neurosnap / plugin.js
Created February 6, 2017 15:18
example plugin middleware
/* REDUCER MIDDLEWARE */
export const PluginMiddleware = (actionTypes) => store => next => action => {
action.actionTypes = actionTypes;
return next(action);
}
// example reducer
const counter = (state, action) => {
const actionTypes = action.actionTypes;
describe('getFolderCount', () => {
const getFolderCount = selectors.getFolderCount;
before(() => {
sinon.stub(selectors, 'getDisplayFolderProp');
sinon.stub(selectors, 'getFoldersHash');
sinon.stub(selectors, 'calcFolderCount');
sinon.stub(coreSelectors, 'getMailboxes');
sinon.stub(coreSelectors, 'getThreadIdsByFolder');
getFolderCount({}, {});
});
@neurosnap
neurosnap / actionCreator.js
Created November 19, 2016 03:39
Simple action creator
// actionCreator.js
export default (type: string) => (payload: Object) => ({ type, payload });
// Examples
export const FETCH_THREADS = 'threadFetch/FETCH';
export const fetchThreads = actionCreator(FETCH_THREADS);
export const FETCH_NEXT_PAGE = 'threadFetch/FETCH_NEXT_PAGE';
export const fetchNextPage = actionCreator(FETCH_NEXT_PAGE);
function main(sources) {
const auth$ = Auth(sources);
const apiDomain = getAPIDomain();
const apiMailboxes = `${apiDomain}/mailboxes`;
const getMailboxes$ = auth$.state$.map(accInfo => {
console.log(accInfo);
return {
url: apiMailboxes,
async function getThreads(api, dispatch) {
try {
let mailboxes = await api.get(`mailboxes`);
mailboxes = mailboxes.mailboxes;
for (let i = 0; i < mailboxes.length; i++) {
let box = mailboxes[i];
let inbox = await api.get(`mailboxes/${box.id}/threads/folder/in`);
for (let i = 0; i < inbox.threads.length; i++) {
@neurosnap
neurosnap / wat.py
Last active September 10, 2015 13:49
members = {
"class": self._class,
"number": self.number,
"part_number": self.part_number,
"description": self.description,
"quantity": self.quantity,
}
return """Class: {class}\t
Number: {number}\t
@neurosnap
neurosnap / author.py
Created May 4, 2015 14:51
Authors on Freep Article
# -*- coding: utf-8 -*-
from __future__ import print_function
import re
import requests
# lets download the article web page
r = requests.get('http://www.freep.com/story/life/advice/2015/05/04/mother-law-meant-selfish/26706999/')
print("Grabbing data from {}".format(r.url))
r.raise_for_status()

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@neurosnap
neurosnap / gist:c1580fe7b33f65330c23
Last active August 29, 2015 14:03
Array of dictionaries to group data
@app.route('/')
def landing():
arts = Articles.query.\
filter(Articles.active==True).\
filter(Articles.ready==True).all() #.\
#order_by(desc(Articles.created)).all()
# get today's date
today = datetime.date.today()
@neurosnap
neurosnap / gist:f7f9989941ef21346332
Created July 8, 2014 18:25
V3 SpokenLayer landing.js
$(function() {
$("#nol_start").on("click", function() {
$("#sl_queue > div").each(function() {
sl_start(this);
});
});
$(".nol_play").on("click", function() {
//sl_start(this);