Skip to content

Instantly share code, notes, and snippets.

totally not a horse in sunglasses

Mudit Ameta zeusdeux

totally not a horse in sunglasses
View GitHub Profile
zeusdeux / workingHours.ts
Created Apr 7, 2020
Intense validations using yupjs
View workingHours.ts
const workingHoursSchema = yup
startHour: yup.number().when(["startMinute", "endHour", "endMinute"], {
is: (...args: string[]) => args.reduce((acc, v) => !!v || acc, false as boolean), // really typescript :|
then: yup
zeusdeux / hasSequence.js
Created Mar 16, 2020
Find if a sequence represented by an array of items in some order is in a dataset that is presented as an array as well
View hasSequence.js
function assertArray(v) {
if (!Array.isArray(v)) {
throw new TypeError(`Expected ${v} to be an array`)
return true
function hasSequence(data, seq) {

Speaker Rider

by Tatiana Mac

Before I'll agree to a speaking event, I try to do as much research I can around the event to ensure it aligns with my ethos. I want to share this in case it's helpful to any other speakers.

👐 Speaking comes with immense privilege. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most marginalised and suppressed communities.

😫 I wish I didn't have to, but this is long because I provide a lot of explanations for those of you who never had to consider these things. And I will be honest, most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

1️⃣ All of these are based on my own ethos. I don't wish to or attempt to speak on behalf of all conference speake

View Reach

Reach UI Philosophy

Reach UI is an accessible foundation for React applications and design systems.

The three equally important goals are to be:

  • Accessible
  • Composable
  • Stylable
zeusdeux / boop.js
Created Aug 30, 2019
How to cress?
View boop.js
import React from 'react'
import { Cress } from './path/to/Cress.js';
// looks like dead-code right?
new Cress('.my-selector', {
css() {
return `
this {
font-family: cursive;
zeusdeux /
Created Aug 23, 2019 — forked from ygotthilf/
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out
cat jwtRS256.key
zeusdeux / .eslintrc.js
Created Jul 26, 2019
eslint override ordering example
View .eslintrc.js
module.exports = {
overrides: [
files: ['src/**/*.js'],
rules: {
'some-rule': 'error',
'some-other-rule': 'error'
zeusdeux / Either.ts
Last active May 23, 2020
Another Maybe and Either implementation in Typescript without making the value constructors (Just, Nothing, Left and Right) types themeselves as in the previous attempt
View Either.ts
// Either monad using discriminated unions
export type Either<L, R> =
| { type: "left"; value: L }
| { type: "right"; value: R };
export function Left<L, R>(a: L): Either<L, R> {
return {
type: "left",
value: a
zeusdeux /
Last active Aug 20, 2019
My goto script to check if any of my passwords have been compromised using HIBP's password API ( Your password never leaves your local system!
#!/usr/bin/env bash
# enable when debugging
# set -o errexit
# set -o errtrace
# set -o xtrace
# set -o nounset
# set -o pipefail
plsno () {
zeusdeux / sumTypesWithNever.ts
Created Jan 5, 2019
Sum types with never in typescript
View sumTypesWithNever.ts
// never is dropped from sum types
let x: string | never // string
let y: Exclude<'a' | 'b', 'b'> // y has the type 'a'
* Explanation:
* Given that Exclude is defined as: type Exclude<T, U> = T extends U ? never : T
* Exclude<'a' | 'b', 'b'> checks if 'a' extends 'b'.
* It doesn't and hence 'a' is returned
* Type system then checks if 'b' extends 'b'.
You can’t perform that action at this time.