Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nealeu's full-sized avatar

Neale Upstone nealeu

  • Wormhole Technology Ltd
  • Cambridge, UK
View GitHub Profile
@nealeu
nealeu / Thymeleaf-test.html
Created March 4, 2014 22:32
Processing Thymeleaf template in Javascript...
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<head>
<title>Good Thymes Virtual Grocery</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="all"
href="../../../css/gtvg.css" th:href="@{/css/gtvg.css}" />
wget https://dl.google.com/android/repository/tools_r25.2.3-linux.zip
mkdir ~/apps/android-sdk
gunzip tools*linux.zip ~/apps/android-sdk
~/apps/android-sdk/tools/bin/sdkmanager --list
~/apps/android-sdk/tools/bin/sdkmanager "build-tools;25.0.2"
@nealeu
nealeu / rc-producer.yml
Last active March 20, 2017 16:20
Config to get IDEA >= 17.0 to run Jasmine tests (goes in .idea folder)
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}"
@nealeu
nealeu / CardContainer.tsx
Created May 23, 2017 21:06
Something to refactor into presentational and container components
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
nealeu / ConfigurableAccessTokenConverter
Last active June 19, 2017 21:34
JWK for Auth0 (and prob enough for Okta too)
public class ConfigurableAccessTokenConverter extends DefaultAccessTokenConverter {
public ConfigurableAccessTokenConverter(String usernameAttributeKey) {
super();
setUserTokenConverter(new DefaultUserAuthenticationConverter() {
@Override
public Authentication extractAuthentication(Map<String, ?> map) {
if (map.containsKey(usernameAttributeKey)) {
@nealeu
nealeu / react-async.d.ts
Last active November 8, 2018 01:21
Typescript typings for react-async
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
nealeu / acme-widget
Created January 3, 2019 20:42
Independent go projects with dep
#!/bin/bash
# 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'
CLIENT_ROOT=$HOME/clients/acme
export GOPATH=$CLIENT_ROOT
cd $GOPATH/src/widget
# widget is the project directory as cloned from source control
@nealeu
nealeu / OpenRTB.http
Created January 8, 2019 13:37
An example OpenRTB request used when testing adapter on prebid-server
# 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
nealeu / Controller.java
Created February 6, 2019 11:01
Spring Framework caching of Etagged responses
@GetMapping("/expensiveEndpoint")
public void findGlobalConfig(WebRequest request, HttpServletResponse response) throws IOException {
// Optionally String myCacheKey = buildKey(params)
etaggedResponseCacheManager.getFromCacheWithEtagHandling(
request, response,
"myCacheName", "myCacheKey", 3600,
() -> {
return expensiveToBuildAndSerialize();
}
@nealeu
nealeu / bitbucket-pipelines.yml
Last active June 17, 2019 10:14
Check commits contain reference to tickets on Bitbucket/Shippable branch
pipelines:
branches:
*:
- step:
script:
- 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