Skip to content

Instantly share code, notes, and snippets.

View kevinold's full-sized avatar

Kevin Old kevinold

View GitHub Profile
const { SF_username, SF_password, SF_client_id, SF_client_secret, SF_security_token } = Cypress.env()
describe('Programmatically log in to SF app', () => {
it('makes XHR req & loads dashboard', () => {
Cypress.log({name: 'loginViaOAuth'});
// request access token from SF OAuth endpoint
const oAuthTokenOptions = {
method: 'POST',
/// <reference types="cypress" />
import { random } from 'lodash'
const apiGraphQL = `${Cypress.env("apiUrl")}/graphql`;
const hasMutation = (req, operationName) => {
return req.body.hasOwnProperty("query") && req.body.query.includes(`mutation ${operationName}`)
}
const hasQuery = (req, operationName) => {
@kevinold
kevinold / find-ecr-image.sh
Created February 10, 2021 23:00 — forked from outofcoffee/find-ecr-image.sh
Check if Docker image exists with tag in AWS ECR
#!/usr/bin/env bash
# Example:
# ./find-ecr-image.sh foo/bar mytag
if [[ $# -lt 2 ]]; then
echo "Usage: $( basename $0 ) <repository-name> <image-tag>"
exit 1
fi
IMAGE_META="$( aws ecr describe-images --repository-name=$1 --image-ids=imageTag=$2 2> /dev/null )"

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@kevinold
kevinold / machine.js
Created May 15, 2020 15:25
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
#!/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";