Skip to content

Instantly share code, notes, and snippets.

View amatiasq's full-sized avatar

A. Matías Quezada amatiasq

View GitHub Profile
interface Message<Type extends string | number, Data = never> {
type: Type;
data: Data;
}
type MessageData<
Msg extends Message<any, any>,
Type extends Msg['type']
> = Extract<Msg, { type: Type }>['data'];
let cache = null;
export function myCachedRequest() {
if (cache) {
return Promise.resolve(cache);
}
return fetch('potato.com/foo').then(x => {
cache = x;
return x
let url = '';
a
.split('\n')
.map(x => {
if (!x) {
return x;
}
if (x.startsWith('- [Lesson ')) {
  • 0:00 Event Presentation
  • 2:03 Presenter Introduces Uncle Bob
  • 3:41 Uncle Bob Introduction / My Tribe
  • 4:49 How Far is the Sun?
  • 10:52 Introduction to Clean Code
  • 12:21 The current Society works with Software
  • 19:47 Volkswagen case / Introduction to the Ethics of Software Development
  • 24:28 Why are Programmers so slow?
  • 32:13 What is a Clean Code?
@amatiasq
amatiasq / softwarecraftsmanship.json
Created August 21, 2020 15:41
Signers of Software Craftmanshift Manifesto (so far)
This file has been truncated, but you can view the full file.
[
{
"name": "Doug Bradbury",
"location": "Chicago, IL, USA"
},
{
"name": "Corey Haines",
"location": "Cleveland, OH"
},
{
#!/bin/bash
# Clone repo
sudo apt install git
git clone https://github.com/ayulockin/3d-photo-inpainting.git
# Install python 3.7
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
let screen = Vector(800., 600.)
let ball = Circle 10.
let box = Rectangle screen
let collision = detectCollision ball box
match collision with
| NoCollision -> ...
| Collision FullContact -> x
| Collision (PartialCollision side) -> x
@amatiasq
amatiasq / index.html
Created May 11, 2020 21:22
composable cell
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script type="module" src="run.js"></script>
<style>
html,
body,
@amatiasq
amatiasq / fable-repl.css
Created April 19, 2020 23:27
Created with Fable REPL
html, body {
margin: 0;
padding: 0;
background-color: black;
}
[<Struct>]
type Vector =
{ X: float; Y: float; Z: float }
static member (*) (k, v: Vector) = { X = k * v.X; Y = k * v.Y; Z = k * v.Z }
static member (-) (v1: Vector, v2: Vector) = { X = v1.X - v2.X; Y = v1.Y - v2.Y; Z = v1.Z - v2.Z }
static member (+) (v1: Vector, v2: Vector) = { X = v1.X + v2.X; Y = v1.Y + v2.Y; Z = v1.Z + v2.Z }
static member Dot (v1: Vector, v2: Vector) = v1.X * v2.X + v1.Y * v2.Y + v1.Z * v2.Z
static member Mag (v: Vector) = sqrt (v.X * v.X + v.Y * v.Y + v.Z * v.Z)
static member Norm (v: Vector) =
let mag = Vector.Mag v