Red/green/refactor:
- Red: Write a test that does not work, maybe does not even compile
- Green: Make the test work quickly, be OK with any "sins" this might entail
- Refactor: Eliminate duplication and "sins"
Social effects of writing tests:
| class Thing { | |
| constructor() { | |
| console.log('Done!'); | |
| } | |
| static create() { | |
| console.log('Ding!'); | |
| return new Thing(); | |
| } | |
| } |
| { | |
| "schemaVersion": "2021-11-01", | |
| "name": "Replace with lens name", | |
| "description": "Replace with your description", | |
| "pillars": [ | |
| { | |
| "id": "pillar_id_1", | |
| "name": "Pillar 1", | |
| "questions": [ | |
| { |
| const data = { | |
| age: 37, | |
| firstName: 'Same', | |
| lastName: 'Person', | |
| something: 123 | |
| }; | |
| function reflection(obj: Record<string, any>) { | |
| Reflect.deleteProperty(obj, 'something'); | |
| console.log(obj); |
| class DecoratorDemo { | |
| @log | |
| public do() { | |
| console.log('BLIP'); | |
| } | |
| } | |
| const d = new DecoratorDemo(); | |
| d.do(); |
| # See: https://alsmola.medium.com/github-actions-signing-lambda-code-5b7444299b | |
| # See: https://blog.awsfundamentals.com/serverless-framework-resource-extensions | |
| service: code-signing-demo | |
| provider: | |
| name: aws | |
| runtime: nodejs18.x | |
| architecture: arm64 | |
| stage: ${opt:stage, 'prod'} |
| import fs from 'fs'; | |
| import readXlsxFile from 'read-excel-file/node'; | |
| import { Cell, Row } from 'read-excel-file/types'; | |
| const config = { | |
| inputFile: './file.xlsx', | |
| headers: 'ID,Period,Team', | |
| multiResponseHeaders: { | |
| something: | |
| 'Some header' |
| <!DOCTYPE HTML> | |
| <head> | |
| <title> | |
| Browser import maps demo | |
| </title> | |
| <style> | |
| h1 { | |
| font-family: sans-serif; | |
| } |
| import jwt from 'jsonwebtoken'; | |
| import jwksClient from 'jwks-rsa'; | |
| import { MikroLog } from 'mikrolog'; | |
| const logger = MikroLog.start(); | |
| const keyClient: any = (jwksUri: string) => | |
| jwksClient({ | |
| cache: true, | |
| cacheMaxAge: 86400000, |
| import { Auth0Client, createAuth0Client } from '@auth0/auth0-spa-js'; | |
| const authConfig = { | |
| "domain": "MY_SITE.eu.auth0.com", | |
| "clientId": "SOME_STRING", | |
| "cacheLocation": "localstorage", | |
| "useRefreshTokens": true | |
| } | |
| /** |