Skip to content

Instantly share code, notes, and snippets.


Matt Foxx FoxxMD

View GitHub Profile
tomhicks / plink-plonk.js
Last active Mar 20, 2021
Listen to your web pages
View plink-plonk.js
Jobarion /
Last active Jul 21, 2019
THX Deep Note Generator
MIT License
Copyright (c) 2018 Jonas Balsfulland
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:
The above copyright notice and this permission notice shall be included in all
kitze / store.js
Created Jan 24, 2018
simplified redux
View store.js
import produce from 'immer';
import {createStore} from 'redux';
const handleActions = (actionsMap, defaultState) => (
state = defaultState,
{type, payload}
) =>
produce(state, draft => {
const action = actionsMap[type];
action && action(draft, payload);
ljharb /
Last active Apr 22, 2021
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.


JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

nbrownus /
Last active Apr 20, 2021
Pull snmp stats from edgemax, submit to graphite/carbon
# expects the following env vars
# METRIC_PREFIX - At least the hostname to record these stats under in graphite - collectd.someserver
# SNMP_HOST - the host to pull snmp stats from
# CARBON_HOST - The carbon host to send the stats
# CARBON_PORT - The carbon port to send the stats
NOW="$(date +%s)"
andrewmclagan / Normalizr.php
Last active Aug 3, 2018
Normalized fractal response
View Normalizr.php
namespace App\Http;
use League\Fractal\Pagination\CursorInterface;
use League\Fractal\Pagination\PaginatorInterface;
use League\Fractal\Resource\ResourceInterface;
use League\Fractal\Serializer\ArraySerializer;
class Normalizr extends ArraySerializer
cyrusboadway /
Created Feb 20, 2016
Script to update a Google Domains DNS record
### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
### Google Dynamic DNS:
### Synthetic Records:

How you can help reduce node_modules bloat

This recent reddit thread reveals discontent among the web development community about the sheer volume of stuff in a typical node_modules dir. 140MB in this case!

Is it a design flaw in npm?

Opinions in the thread varied from "I'm surprised npm even works" to "everything is fine". I'm not going to offer an opinion, just these two observations:

  1. node_modules dirs typically do contain lots of stuff that doesn't need to be there.
  2. The latest version mitigates overall size by flattening the dependency tree, but some of the bloat is beyond npm's control.
kentcdodds / JavaScript.xml
Created Aug 3, 2015
Some of my WebStorm live templates
View JavaScript.xml
<templateSet group="JavaScript">
<template name="us" value="'use strict';&#10;$END$" description="Inserts 'use strict' statement" toReformat="true" toShortenFQNames="true">
<context />
<template name="f" value="function $NAME$($PARAM$) {&#10; $END$&#10;}" description="Inserts function expression" toReformat="true" toShortenFQNames="true">
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="PARAM" expression="" defaultValue="&quot;&quot;" alwaysStopAt="true" />
<option name="JAVA_SCRIPT" value="true" />