Skip to content

Instantly share code, notes, and snippets.

View ztolley's full-sized avatar
🏠
Working from home

Zac Tolley ztolley

🏠
Working from home
View GitHub Profile
@ztolley
ztolley / LoginAndAddDecision.scala
Created September 9, 2015 21:01
How to use cross site tokens in gatling
package com.scropt
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class LoginAndAddDecision extends Simulation {
@ztolley
ztolley / autosave.js
Created February 7, 2016 22:46
Generic form autosave used for Digideps
/* globals jQuery: true, GOVUK: true */
/* jshint browser: true */
if (typeof GOVUK === 'undefined') {
GOVUK = {};
}
(function ($, GOVUK) {
"use strict";
var AutoSave = function(options) {
import React, { Component } from 'react';
import {AutosuggestComponent as Autosuggest} from './autosuggest.component';
import axios from 'axios';
export class AddressComponent extends Component {
constructor(props) {
super(props);
this.state = {
reveal: false,
@ztolley
ztolley / gist:9f07d67fbbe52593684af281115eb6a7
Created February 14, 2017 12:20
Generator sync requests
function getDitCompany (id) {
return new Promise((resolve, reject) => {
Q.spawn(function *main () {
try {
const company = yield request(`${config.apiRoot}/company/${id}/`)
// get related information
const relatedKeys = Object.keys(relatedProperties)
for (const property of relatedKeys) {
if (company[property] && company[property].length > 0) {
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
layout_python-venv() {
local python=${1:-python3}
[[ $# -gt 0 ]] && shift
unset PYTHONHOME
if [[ -n $VIRTUAL_ENV ]]; then
VIRTUAL_ENV=$(realpath "${VIRTUAL_ENV}")
else
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
layout_python-venv() {
local python=${1:-python3}
[[ $# -gt 0 ]] && shift
unset PYTHONHOME
if [[ -n $VIRTUAL_ENV ]]; then
VIRTUAL_ENV=$(realpath "${VIRTUAL_ENV}")
else
require("dotenv").config();
const { setContext } = require("apollo-link-context");
const { HttpLink } = require("apollo-link-http");
const { ApolloServer } = require("apollo-server-express");
const express = require("express");
const bodyParser = require("body-parser");
const { graphqlExpress } = require("apollo-server-express/dist/expressApollo");
const {
/* eslint-disable react/prefer-stateless-function */
import React from 'react'
interface WithErrorProps {
className?: string
error?: string
name?: string
}
export const withError = <P extends object>(