Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
branchname=${1:-$(git rev-parse --abbrev-ref HEAD)}
if ! [ -x "$(command -v jq)" ]; then
echo 'Error: "jq" is not installed.' >&2
exit 1
fi
if [ ! $SECRET_GH_TOKEN ]; then
@kevinold
kevinold / machine.js
Created March 24, 2020 22:02
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@kevinold
kevinold / flexRoute.js
Created March 16, 2020 19:36
flexRoute plugin idea
const internalFlexRoute = curry((httpVerb: string, route: string) => {
return cy.route(httpVerb, route);
});
const flexRoute = curry((httpVerb: string, route: string, response: object) => {
const route = internalFlexroute(httpVerb, route);
return route(response);
});
import { omit } from "lodash/fp";
import { Machine, assign } from "xstate";
import { dataMachine } from "./dataMachine";
import { httpClient } from "../utils/asyncUtils";
import { User } from "../models";
export interface CreateTransactionMachineSchema {
states: {
stepOne: {};
stepTwo: {};
import React, { useState, useEffect } from "react";
import { connect } from "react-redux";
import { IRootReducerState } from "../reducers";
import { User, TransactionPayload } from "../models";
import TransactionCreateStepOne from "../components/TransactionCreateStepOne";
import TransactionCreateStepTwo from "../components/TransactionCreateStepTwo";
import { usersSearchPending } from "../actions/users";
import { useMachine } from "@xstate/react";
import { createTransactionMachine } from "../machines/createTransactionMachine";
const dataMachine = Machine({
id: "dataMachine",
initial: "idle",
context: {
pageData: {},
results: []
},
states: {
idle: {
on: {
@kevinold
kevinold / machine.js
Last active March 10, 2020 21:00
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@kevinold
kevinold / jwtUtils-spec.js
Created August 8, 2019 22:32
Test that a JWT is expired or expires within a certain window using Sinon's Fake Timers
import expect from "expect";
import sinon from "sinon";
// Inline version of function to be tested
const expiredOrExpiresWithin = (decodedJwt, seconds) =>
Date.now() >= (decodedJwt.exp + (-Math.abs(seconds) || 0)) * 1000;
describe("jwtUtils", () => {
describe("expiredOrExpiresWithin", () => {
let clock;
@kevinold
kevinold / delay-promise.js
Created June 18, 2019 22:26 — forked from joepie91/delay-promise.js
ES6 Promise.delay
module.exports = function(duration) {
return function(){
return new Promise(function(resolve, reject){
setTimeout(function(){
resolve();
}, duration)
});
};
};
@kevinold
kevinold / README.md
Created June 17, 2019 13:42 — forked from NoriSte/README.md
Conio Business site monitoring

A Cypress test checking the most common issues faced by Conio with the AWS/S3 management (with a custom configuration for Brotli)