Skip to content

Instantly share code, notes, and snippets.

View NicholasBoll's full-sized avatar

Nicholas Boll NicholasBoll

  • Workday
  • Boulder, CO
View GitHub Profile
@NicholasBoll
NicholasBoll / usePopupModel.ts
Created February 24, 2023 20:43
Possible model AST rewrite
import * as React from 'react';
import {createModelHook, ModelExtras, ToEventConfig} from '@workday/canvas-kit-react/common';
import {useDisclosureModel} from '@workday/canvas-kit-react/disclosure';
import {Placement} from '@workday/canvas-kit-react/popup';
// eslint-disable-next-line no-empty-function
const noop = () => {};
export const _usePopupModel = createModelHook({
@NicholasBoll
NicholasBoll / Releases.md
Last active August 1, 2022 18:06
Release strategy

Release Branching

Canvas Kit supports three branch lines for a current major release, previous major release, and the next upcoming major release. Example release numbers will assume a current major release of 2.0.

  • support: The last major support branch (i.e. 1.0). This branch only accepts fixes and will release patch versions with every commit.
  • master: The current major support branch (i.e. 2.0). This branch only accepts fixes and will release patch versions with every commit.
  • prerelease/minor: The current major feature branch (i.e. 2.1). This branch accepts features and fixes and will release minor versions every 3 weeks.
  • prerelease/major: The next major branch (i.e. 3.0). This branch accepts breaking changes, features, and fixes and will release major versions every 6 months. In addition, a release of this branch will advance the "major" of other branches by +1.

Major releases

@NicholasBoll
NicholasBoll / Typescript Infer.md
Created April 20, 2022 16:20
Typescript Infer keyword

Typescript has conditionals like JavaScript does, but they are different.

In JavaScript, conditionals can compare values:

if (a > 1) {
  return true
} else {
  return false
}
@NicholasBoll
NicholasBoll / Major Release.md
Last active November 9, 2022 16:10
Canvas Kit Major Release

Canvas Kit releases major changes every 6 months. Releases are done by a maintainer. The process is similar to minor releases, except the addition of the support branch. All branches have to be forward merged. Check out all of the following to make sure there are no commits listed:

If there are any commits listed, run the forward merge for the branch that isn't merged forward (support, master, or prerelease/minor). It is safe to run this job even if there are no changes since the job will recognize no change and bail.

We'll be using the terms previous major, current major, and next major in the context of versions before the release process is complete. For example, if support is pointing to v4, `ma

@NicholasBoll
NicholasBoll / session-3.md
Last active June 30, 2021 06:16
Session 3

Session 3

Today we'll be covering creating compound components using models, behaviors, and utility functions in Canvas Kit that make composability easier. Please refer to the Create Compound Component docs for reference later.

Get the latest changes:

git fetch --all
@NicholasBoll
NicholasBoll / session-2.md
Last active April 29, 2021 18:20
Session 2 notes

Session 2

fetch latest:

git fetch --all
@NicholasBoll
NicholasBoll / machine.js
Last active September 17, 2020 21:41
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@NicholasBoll
NicholasBoll / machine.js
Created August 13, 2020 05:30
Generated by XState Viz: https://xstate.js.org/viz
const tooltipMachine = Machine({
id: "tooltip",
initial: "closed",
states: {
closing: { on: { CLOSE: "closed", OPEN: "opened" } },
closed: { on: { OPEN: "opened" } },
opened: { on: { CLOSING: "closing", CLOSE: "closed" } }
}
});
@NicholasBoll
NicholasBoll / support.js
Last active November 8, 2023 15:50
Cypress assertion to compare colors
const compareColor = (color, property) => (targetElement) => {
const tempElement = document.createElement('div');
tempElement.style.color = color;
tempElement.style.display = 'none'; // make sure it doesn't actually render
document.body.appendChild(tempElement); // append so that `getComputedStyle` actually works
const tempColor = getComputedStyle(tempElement).color;
const targetColor = getComputedStyle(targetElement[0])[property];
document.body.removeChild(tempElement); // remove it because we're done with it
@NicholasBoll
NicholasBoll / alarms.ts
Last active December 27, 2019 18:11
Cypress helper function using jQuery
export const getByName = (name: string) => function getAlarmByName($container: JQuery): JQuery {
return $container.find(`.alarm-card:contains("${name}")`)
}