Skip to content

Instantly share code, notes, and snippets.


Neale Upstone nealeu

  • Wormhole Technology Ltd / Ecco Solutions Ltd
  • Cambridge, UK
View GitHub Profile
nealeu / docker-compose.yml
Last active Aug 22, 2019
Fake for GCP images with docker-compose
View docker-compose.yml
version: "3"
image: nginx:alpine
- ./metadata-db0:/usr/share/nginx/html:ro
command: [nginx-debug, '-g', 'daemon off;']
View AWS X-Ray
let dynamoDb = new AWS.DynamoDB.DocumentClient(dynamoParams);
if (process.env.XRAY_DYNAMO) {
const AWSXRay = require("aws-xray-sdk-core");
if (process.env.IS_OFFLINE) {
AWS = AWSXRay.captureAWS(AWS);
dynamoDb = AWSXRay.captureAWSClient(dynamoDb);
nealeu / bitbucket-pipelines.yml
Last active Jun 17, 2019
Check commits contain reference to tickets on Bitbucket/Shippable branch
View bitbucket-pipelines.yml
- step:
- npm ci
- npm run lint
- npm test
# == Check that all commits since the base branch (dev) contain ACME- for ticket reference ==
# Fetch the merge base for our project
nealeu /
Created Feb 6, 2019
Spring Framework caching of Etagged responses
public void findGlobalConfig(WebRequest request, HttpServletResponse response) throws IOException {
// Optionally String myCacheKey = buildKey(params)
request, response,
"myCacheName", "myCacheKey", 3600,
() -> {
return expensiveToBuildAndSerialize();
nealeu / OpenRTB.http
Created Jan 8, 2019
An example OpenRTB request used when testing adapter on prebid-server
View OpenRTB.http
# For a quick start check out IDEA's HTTP Requests collection (Tools|HTTP Client|Open HTTP Requests Collection).
POST http://localhost:8000/openrtb2/auction
Content-Type: application/json
"id": "must be string",
"imp": [
"id": "test-imp-id",
nealeu / acme-widget
Created Jan 3, 2019
Independent go projects with dep
View acme-widget
# To start using a project or working for a given client I'll type the client or project name, and I'll have an
# alias defined in .profile to run this (so that I actually end up in the directory that this file cd's to)
# alias 'acme-widget=source $HOME/bin/acme-widget'
cd $GOPATH/src/widget
# widget is the project directory as cloned from source control
nealeu / react-async.d.ts
Last active Nov 8, 2018
Typescript typings for react-async
View react-async.d.ts
declare module "react-async" {
import {ComponentType, ReactNode} from "react";
import * as React from "react";
export interface LoadingProps<V> {
/** Show only on initial load (data is undefined) */
initial?: boolean;
/** Function (passing state) or React node */
children: ReactNode | ((state: State<V>) => ReactNode);
nealeu / ConfigurableAccessTokenConverter
Last active Jun 19, 2017
JWK for Auth0 (and prob enough for Okta too)
View ConfigurableAccessTokenConverter
public class ConfigurableAccessTokenConverter extends DefaultAccessTokenConverter {
public ConfigurableAccessTokenConverter(String usernameAttributeKey) {
setUserTokenConverter(new DefaultUserAuthenticationConverter() {
public Authentication extractAuthentication(Map<String, ?> map) {
if (map.containsKey(usernameAttributeKey)) {
nealeu / CardContainer.tsx
Created May 23, 2017
Something to refactor into presentational and container components
View CardContainer.tsx
import * as React from "react";
import {CardSource, compareCards, Card} from "./cards";
import {EventCard as EventCardObj, EventCardGroup, TaskCard as TaskCardObj, TaskCardGroup} from "../calendar/cards";
import {ReferralCard as ReferralCardObj, ReferralCardGroup} from "../referral/cards";
import ReferralCard = require("./ReferralCard");
import EventCard = require("./EventCard");
import CardGroup = require("./CardGroup");
import TaskCard = require("./TaskCard");
import {ReloadEvent} from "../common/events";
nealeu / rc-producer.yml
Last active Mar 20, 2017
Config to get IDEA >= 17.0 to run Jasmine tests (goes in .idea folder)
View rc-producer.yml
files: ["**/__tests__/**/*", "**/test/**/*", "**/*.(test|spec).*", "**/*Spec.*", "!**/node_modules/**/*"]
script: "./node_modules/jasmine-node/bin/jasmine-node"
lineRegExp: '^\s*(?:test|it|describe)(?:\.[^(]+)?\((?:"|''){1}([^"'']+)'
scriptArgs: ["${file}", "--verbose", "--color", "--forceexit", "--junitreport", "--captureExceptions"]
rcName: "${fileNameWithoutExt}.${0}"