Skip to content

Instantly share code, notes, and snippets.


Stephen Parish stephenparish

View GitHub Profile
tomhicks / plink-plonk.js
Last active Oct 28, 2020
Listen to your web pages
View plink-plonk.js
View PropsType.ts
import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
* Get the type that represents the props with the defaultProps included.
* Alternatively, we could have done something like this:
MarcoWorms / mini-redux.js
Last active Feb 26, 2019
Redux in a nutshell
View mini-redux.js
function createStore (reducers) {
var state = reducers()
const store = {
dispatch: (action) => {
state = reducers(state, action)
getState: () => {
return state
skellock / gist:b8513985e56b03a59963188803b4184e
Created Apr 26, 2016
Sends a shake command to each attach android device.
View gist:b8513985e56b03a59963188803b4184e
$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82
marick /
Last active Jun 5, 2020
About Those Lava Lamps

Around 2006-2007, it was a bit of a fashion to hook lava lamps up to the build server. Normally, the green lava lamp would be on, but if the build failed, it would turn off and the red lava lamp would turn on.

By coincidence, I've actually met, about that time, (probably) the first person to hook up a lava lamp to a build server. It was Alberto Savoia, who'd founded a testing tools company (that did some very interesting things around generative testing that have basically never been noticed). Alberto had noticed that people did not react with any urgency when the build broke. They'd check in broken code and go off to something else, only reacting to the breakage they'd caused when some other programmer pulled the change and had problems.

wmertens / full stack
Last active May 12, 2020
making an awesome server with the redux model, Work In Progress
View full stack

Thought experiment: Redux-like stateless server


We describe a model for client-server processing where the Redux model is used to minimize stateful code. This should allow live-reloading server code, and make it possible to share code (e.g. optimistic updating) between client and server.

Dramatis Personae

  • Assume a server consisting of multiple worker processes that do not share memory and may be running on multiple hosts.
    • Workers have middleware, root reducers and an app state object
    • Workers can be dynamically added and removed
sebmarkbage / Enhance.js
Last active Oct 16, 2020
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
componentDidMount() {
this.setState({ data: 'Hello' });
render() {
JakeWharton / gist:f50f3b4d87e57d8e96e9
Created Feb 7, 2015
Rise and Shine™, unlock and wake up your device automatically when you deploy from the IDE. Put this somewhere in your `src/debug/` code and run it when the application or main activity starts. Apache 2.
View gist:f50f3b4d87e57d8e96e9
* Show the activity over the lockscreen and wake up the device. If you launched the app manually
* both of these conditions are already true. If you deployed from the IDE, however, this will
* save you from hundreds of power button presses and pattern swiping per day!
public static void riseAndShine(Activity activity) {
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock lock =
JakeWharton /
Last active Jan 8, 2020
A JUnit @rule which launches an activity when your test starts. Stop extending gross ActivityInstrumentationBarfCase2!
* Copyright (C) 2014 The Android Open Source Project
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
You can’t perform that action at this time.