Skip to content

Instantly share code, notes, and snippets.

@laser
laser / 0a.hs
Last active April 13, 2023 14:06
An Introduction to ADTs and Structural Pattern Matching in TypeScript
data Failable t e = Success t | Failure e
@laser
laser / blog-adts-di.md
Last active May 12, 2020 09:54
An ADT-Based Alternative to Dependency Injection in TypeScript

Preface

Like unit testing but dislike mocks and stubs? Want to keep your business logic separate from your side effects? In this blog post, I'll demonstrate a novel approach to testing which relies not on the [Dependency Injection][4] pattern, but an algebraic data structure and some simple functions.

A Real World Example

I was recently working on a system for a real estate company which merged a

@laser
laser / candid-ipm-november-13.md
Last active November 13, 2017 18:52
IPM November 13

Agenda

  • Talk about what we did last (short) week
  • Look at the backlog to ensure that we've got things in the correct order
  • Talk about our plan for next week

Last Week

  • Kick-off
  • Estimation
@laser
laser / OMC-18372.md
Created August 23, 2017 20:58
OMC-18372: user (non-)editable design elements

Dynamic Samples A

GIVEN

  • a video design D with elements:

    • E1: symbol=view_1.text_1,type=text,userEditable=false,defaultText=null
    • E2: symbol=view_1.text_2,type=text,userEditable=true,elementLevelDefaultText="Eighty",accountPlanLevelDefaultText="Sixty"
    • E3: symbol=view_1.text_3,type=text,userEditable=true,defaultText=null
  • E3: symbol=view_1.text_4,type=text,userEditable=false,elementLevelDefaultText="Twenty"
@laser
laser / side-by-side.html
Last active May 30, 2017 19:01
Side-by-side Tool
<html>
<head>
<title>Side by Side Tool</title>
</head>
<body>
<div id="foo">
<label>
<select name="outputType">
<option value="gen">Gen</option>
<option value="comp">Comp</option>
@laser
laser / demo-20170523.md
Last active May 23, 2017 22:26
Quick Demo

What can this thing do so far?

  • works with PDFV2 (e.g. RLP_BUSINESSCARD_CORP_001_EN) and PDFV3 (IMP_FLYER_2PG_EDE_101) designs, so far

  • admin can create configurations which specify an image set id, resource-key-to-strings mapping, and symbol-to-strings mapping

{
  "imageSetId": "corcoran-4",
 "resourceKeyValues": {
{
"resourceKeyValues": {
"EDE_PROPERTY_ADDRESS": "999 Pine Ave."
},
"symbolValues": {
"view_1.disclaimer_1": "Guaranteed or Your Money Back",
"agent_1.photo_1": "http://acme-broker.example.com/agents/agent-1.jpg"
}
}
@laser
laser / __functors.md
Last active May 11, 2017 19:44
Functors and Applicative Functors

What's a Functor?

A functor is a type class that is used for types that can be mapped over.

What's it mean to "map over" something?

Map Over a List

mapList :: (a -&gt; b) -&gt; [a] -&gt; [b]

Create an SPM Overide: Proposal to Modify Catalog Service HTTP Interface

As part of implementing PAG-1353 we propose an addition to the In Season Catalog Customer Choice HTTP API that will permit the creation of Store Planning Management (SPM) overrides.

Things that the final implementation must permit:

  • Create an SPM override-value for a SKU + location combo
  • Create an SPM override-value for a CC + location combo

(Existing) Create SPM override for CC + Location

@laser
laser / stuff-we-gotta-do.md
Last active December 2, 2016 18:58
Codin' the Codes

Codin' the Codes

[ ] - Get some HTML serving up from Spring application

[ ] - Create some SASS that gets bundled up and served with that HTML

[ ] - Create some JavaScript that also gets bundled up n' served

[ ] - Write a JavaScript unit test (to make sure we know where to put 'em)