Skip to content

Instantly share code, notes, and snippets.

@andycmaj
andycmaj / machine.js
Created March 25, 2021 22:52
Generated by XState Viz: https://xstate.js.org/viz
// https://xstate.js.org/viz/?gist=2347aa48160b6486cd6e52b651dc956d
const mergeRequestStateMachine = Machine(
{
id: 'MergeRequestState',
context: {
finalApprovalActivity: null,
codeReviewStates: {},
@andycmaj
andycmaj / mergeRequestStateMachine.ts
Last active March 27, 2021 03:39
Merge/Pull Request State Machine for XState
import { DateTime } from 'luxon';
import { Machine, assign } from 'xstate';
type Maybe<T> = T | null | undefined;
export type AnyCodeReviewActivity =
| CodeReviewCreatedActivity
| CodeReviewRequestedActivity
| CodeReviewMergedActivity
| CodeReviewDiscussedActivity
@andycmaj
andycmaj / machine.js
Last active January 26, 2021 23:29
Generated by XState Viz: https://xstate.js.org/viz
const mergeRequestStateMachine = Machine({
id: 'MergeRequestState',
context: {
finalApprovalActivity: null,
codeReviewStates: {},
comments: [],
mentionStates: [],
},
type: 'parallel',
states: {
@andycmaj
andycmaj / machine.js
Last active January 7, 2021 07:34
Generated by XState Viz: https://xstate.js.org/viz
const updateCodeReviewStatesOnSubmitted = (contextField, event) => (Object.assign(Object.assign({}, contextField.codeReviewStates), { [event.actorId]: 'Approved' }));
const updateFinalApprovalActivity = (_, event) => event;
// https://xstate.js.org/viz/?gist=2347aa48160b6486cd6e52b651dc956d
const mergeRequestStateMachine = Machine({
id: 'MergeRequestState',
initial: 'Open',
context: {
finalApprovalActivity: null,
codeReviewStates: {},
},
@andycmaj
andycmaj / whatsthisdo.js
Last active December 4, 2020 23:47
waht's this do?
const isArray = function (a) {
return Array.isArray(a);
};
const isObject = function (o) {
return o === Object(o) && !isArray(o) && typeof o !== 'function';
};
const convert = (s) => {
return s.replace(/([-_][a-z])/ig, (matchedString) => {
return matchedString.toUpperCase()
.replace('-', '')
@andycmaj
andycmaj / helm-op
Created November 23, 2020 19:18
helm deployment env with 1p cli
FROM dtzar/helm-kubectl:3.4.0
ENV OP_CLI_VERSION=1.8.0
WORKDIR /tmp
RUN apk add --no-cache curl make gettext unzip jq ca-certificates \
&& curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/latest_release/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp \
&& mv /tmp/eksctl /usr/local/bin \
&& curl --silent -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/linux/amd64/aws-iam-authenticator \
&& chmod +x ./aws-iam-authenticator \
import {
BarChart as GrommetBarChart,
Bar,
XAxis,
Tooltip,
TooltipProps,
ContentRenderer,
} from 'recharts';
@andycmaj
andycmaj / keybase.md
Created April 16, 2020 16:34
keybase.md

Keybase proof

I hereby claim:

  • I am andycmaj on github.
  • I am andycunn (https://keybase.io/andycunn) on keybase.
  • I have a public key ASA50tPGtUN2Bt6e3csP2vCQOlar6fPVRH1vV2pVYdSrggo

To claim this, I am signing this object:

@andycmaj
andycmaj / git-cookbook.md
Last active January 18, 2020 21:29
git cookbook

Move Last Git Commit to New or Existing Branch

# create a new branch called ‘feature’ from current
# commit (commit you want to move)
$ git branch feature
# hard resets (staging and working tree) the existing
# branches HEAD to the previous commit
$ git reset --hard HEAD~1 # or commit SHA1
// see https://github.com/amio-io/await-trace/blob/master/src/main.js
module.exports = function() {
// eslint-disable-next-line prefer-rest-params
const t = arguments[0].types;
return {
name: 'await-full-stacktrace',
pre() {
this.visited = new Map();