Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Broschwitz pbroschwitz

View GitHub Profile
@pbroschwitz
pbroschwitz / function-overloading-with-compose.ts
Created Jul 19, 2022
Master FUNCTION OVERLOADS with 'compose' - example from Matt Pocock
View function-overloading-with-compose.ts
// See https://www.youtube.com/watch?v=D1a8OoBWi1g&list=PLIvujZeVDLMx040-j1W4WFs1BxuTGdI_b&index=10
function compose(...args: any[]) {
return {} as any;
}
const addOne = (a: number) => {
return a + 1;
}
@pbroschwitz
pbroschwitz / index.md
Last active May 25, 2022
Object literal may only specify known properties in TypeScript - ts(2345)
View index.md

Problem

const someArray = ['foo', 'bar']
const someOtherArray = ['foobar', 'barfoos']

const config = [
    ...someArray,
    ...someOtherArray,
    {
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View index-stage.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Parent iframe</title>
</head>
<body>
<h1>Parent iframe</h1>
<textarea id="log" width="40" height="30"></textarea>
View debug-beforeunload.js
// Paste this for example to the console
window.addEventListener(“beforeunload”, function() { debugger; }, false)
@pbroschwitz
pbroschwitz / launch.json
Last active Mar 18, 2020
vscode launch.json - debug jest unit tests
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Unit Tests",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
View vsc-terminal-toggle.json
// keybindings.json
// Toggle between terminal and editor focus
{ "key": "ctrl+shift+oem_3", "command": "workbench.action.terminal.focus"},
{ "key": "ctrl+shift+oem_3", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"}
@pbroschwitz
pbroschwitz / Pure-functions.html
Last active Feb 11, 2017
Pure functions / impure functions
View Pure-functions.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Pure functions</title>
</head>
<body>
<p>Reference: <a href="https://egghead.io/lessons/javascript-redux-pure-and-impure-functions">Egghead</a></p>
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.rawgit.com/zloirock/core-js/master/client/shim.min.js"></script>
<script src="https://wzrd.in/standalone/tape@latest"></script>
<script src="https://wzrd.in/standalone/tap-browser-color@latest"></script>
<script src="http://fb.me/react-with-addons-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>