Skip to content

Instantly share code, notes, and snippets.

View ek's full-sized avatar

Eric ek

View GitHub Profile
@ek
ek / machine.js
Last active January 5, 2021 01:22
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
Entry*
Initialize flow -> Step 1
Step Flow
Cancel -> Entry
Step 1*
Next -> Step 2
Step 2
Next -> Step 3
Step 3
@ek
ek / regex-match-all-css-html-color-keywords.txt
Created September 27, 2018 22:44
Regex to match all CSS / HTML color keywords / names
(?:^|(?<= ))(AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGray|DarkGrey|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGray|DarkSlateGrey|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGray|DimGrey|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gray|Grey|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGray|LightGrey|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGray|LightSlateGrey|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|Mi
@ek
ek / html-color-names-keywords-list.txt
Created September 27, 2018 22:18
HTML / CSS Color Names / Keywords list
AliceBlue
AntiqueWhite
Aqua
Aquamarine
Azure
Beige
Bisque
Black
BlanchedAlmond
Blue
@ek
ek / output
Created July 20, 2018 19:19
yarn upgrade output
➜ promotions-personalized-offers-ui git:(master) yarn upgrade @appfabric/plugin-build@3.11.2
yarn upgrade v1.7.0
[1/4] 🔍 Resolving packages...
warning @appfabric/plugin-build > babel-preset-es2015@6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
warning @appfabric/plugin-build > babel-relay-plugin@0.8.1: Replaced by the new babel-plugin-relay
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "@cg/partnerplatform-web-shared > uglifyjs-webpack-plugin@1.2.5" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
warning "@cg/partnerplatform-web-shared > uglifyjs-webpack-plugin > schema-utils@0.4.5" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
warning " > react-modal@3.3.2" has unmet peer dependency "react@^0.14.0 || ^15.0.0 || ^16".
@ek
ek / opp-score-jtbd-analysis.md
Last active March 29, 2022 13:57
Process to compute opportunity scores for Jobs to be Done survey analysis

Process to compute opportunity scores for Jobs to be Done survey analysis

Inputs

  • Given an array of outcomes.
  • Given an array of responses to a survey on importance and satisfaction ratings for each of the outcomes.
  • Given the response ratings are 1-5.
  • IMP = 10 x % Very or Extremely important
  • SAT = 10 x % Very or Extremely satisfied
  • OPP = IMP + MAX (IMP-SAT, 0)
  • Values of 4 or 5 are considered Very or Extremely important / satisfied
@ek
ek / build-to-grow-no-silver-bullet-snip.txt
Created August 9, 2016 05:46
Brooks suggesting a move from "build" to "grow" as the key metaphor in software development
In "No Silver Bullet" [1] Brooks wrote in 1986:
"I still remember the jolt I felt in 1958 when I first heard a friend talk about building a program,
as opposed to writing one. In a flash he broadened my whole view of the software process. The
metaphor shift was powerful, and accurate. Today we understand how like other building processes the
construction of software is, and we freely use other elements of the metaphor, such as
specifications, assembly of components, and scaffolding."
"The building metaphor has outlived its usefulness. It is time to change again. If, as I believe,
the conceptual structures we construct today are too complicated to be specified accurately in
@ek
ek / extract-query-string-variable.js
Created March 12, 2016 00:06
Extract a variable from window.location query string
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
@ek
ek / generateUniqueId.js
Created January 19, 2016 02:12
generate a unique UUID using Javascript Math.random
// from alexmorleyfinch's comment on this thread:
// https://gist.github.com/gordonbrander/2230317#gistcomment-1618310
var generateUniqueId = function(){
function chr4(){
return Math.random().toString(16).slice(-4);
};
return chr4() + chr4() +
'-' + chr4() +
'-' + chr4() +
'-' + chr4() +
@ek
ek / L1Animation.as
Last active August 29, 2015 14:27
Animation code for L1 Outerwear 2008 Flash site
// help the book get centered...
_root.bookOffsetX = 220;
_root.bookOffsetY = 400;
// this function runs every time the window is resized.
var resizeFunction = function() {
// find the scale for book_mc
stagewidth = Stage.width;
stageheight = Stage.height;