Skip to content

Instantly share code, notes, and snippets.

Tom Robinson tlrobinson

Block or report user

Report or block tlrobinson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tlrobinson
tlrobinson / immutable-wrappers.md
Last active Sep 30, 2019
Metabase immutable wrapper classes
View immutable-wrappers.md

metabase-lib/lib/metadata:

  • "Base" base class
  • copies properties
  • also includes "_plainObject"
  • external logic sets up references, lame: "metabase/selectors/metadata"

metabase-lib/lib/Dimension.js:

  • "Dimension" base class, encode each clause as a different subclass
  • also includes optional "_parent" (actually a child in the tree, i.e. ["field-id", 1] is a _parent in ["datetime-field", ["field-id", 1], "month"]) and "_args" which are rest of clause args (month the datetime-field or 1 in the field-id)
  • also includes "_metadata" and "_query" properties
@tlrobinson
tlrobinson / geiger.ino
Last active Sep 12, 2019
MightyOhm Geiger Counter Kit + ESP8266 (WEMOS D1 mini) https://mightyohm.com/blog/products/geiger-counter/
View geiger.ino
// get config.h from Adafruit IO example sketch and fill in your details
#include "config.h"
#include <Pins_Arduino.h>
#include <SoftwareSerial.h>
#include <Regexp.h>
AdafruitIO_Feed *cpm_feed = io.feed("Geiger CPM");
AdafruitIO_Feed *cps_feed = io.feed("Geiger CPS");
AdafruitIO_Feed *usv_feed = io.feed("Geiger uSv/hr");
@tlrobinson
tlrobinson / ham-mac-setup.sh
Last active Aug 13, 2019
ham radio / amateur radio setup notes for mac and raspberry pi
View ham-mac-setup.sh
# hackrf
brew install dfu-util hackrf
# gqrx
brew cask upgrade gqrx
# misc sdr
brew cask install cubicsdr
brew cask install SdrDX
brew cask install cutesdr
@tlrobinson
tlrobinson / webapp.md
Last active Mar 6, 2019
Polished Single Page Web Application Concerns
View webapp.md
  • loading and error states
  • form validation/errors + dirty/invalid states
  • empty states
  • pagination and/or virtualization/windowing of large lists
  • normalizing state to ensure consistency
  • caching requests / cache invalidation
  • immediate feedback: optimistic updates and/or loading states
  • blocking duplicate actions (loading/dirty states for SPA, POST/redirect/GET for non-SPA)
  • cancelling pending requests when making an updated request (e.x. typeahead), or when navigating away from the screen that depends on it
  • keyboard/mouse events:
@tlrobinson
tlrobinson / docker-build-context-ls.sh
Created Jan 21, 2019
Script for listing the Docker build context of the current directory
View docker-build-context-ls.sh
#!/usr/bin/env bash
set -eu
tag=tmp-docker-build-context
docker build --no-cache -t $tag -f - . <<EOD
FROM busybox
RUN mkdir /_/
View gist:ab0ab25a17793427410552923ea546aa
{
Devices {
devices {
deviceId
uuid
}
}
AirDataLatest(uuid: "awair-...") {
airDataSeq {
score
View docker-machine-push
#!/usr/bin/env bash
set -eu
MACHINE=$1
IMAGE=$2
MONITOR=$(command -v pv || echo cat)
docker save $IMAGE | bzip2 | $MONITOR | docker-machine ssh $MACHINE 'bunzip2 | docker load'
@tlrobinson
tlrobinson / log-loader.js
Last active Aug 6, 2018
webpack logging loader
View log-loader.js
module.exports = function(source) {
return (
`console.log("Loading: " + ${JSON.stringify(this._module.userRequest)});\n` +
source +
`\nconsole.log("Loaded: " + ${JSON.stringify(this._module.userRequest)});`
);
};
@tlrobinson
tlrobinson / hello.clj
Created Jul 17, 2018
java swing in clojure hello world
View hello.clj
(javax.swing.SwingUtilities/invokeLater (fn []
(let [frame (new javax.swing.JFrame "HelloWorldSwing")
label (new javax.swing.JLabel "Hello World")]
(.setDefaultCloseOperation frame javax.swing.JFrame/EXIT_ON_CLOSE)
(.add (.getContentPane frame) label)
(.pack frame)
(.setVisible frame true))))
You can’t perform that action at this time.