Type “claude” to start
- I typically navigate to repo I want to work in first
/loop runs any prompt on a recurring schedule. Great for monitoring deploys, babysitting PRs, or polling status.
| // typeof | |
| // extract a type from runtime code, typeof "make a type of it" (i.e. from it) | |
| // e.g. typeof "Hello world" => string | |
| // only legal on variable names | |
| // can be used with functions or any other expressions | |
| // aside: typeof vs keyof: keyof takes a type and creates a string/number union of it's keys. So keyof creates a new type from a type ....whereas typeof creates a type from an expression. good post | |
| // Given a function below type the function into MyFunc. When the function changes, the types change! | |
| const myFunc = (name: string) => { |
| /* | |
| * ShadowComponent a simple Web Component to render content passed and wrap it in a shadow dom | |
| * why web component? to create shadow dom and isolate html & styles passed in content prop | |
| * usage: | |
| * <shadowcomponent-wc content={html} /> | |
| * | |
| * ShadowComponent will rerender when the value passed to content changes. | |
| * content passed is trusted and security is the responsibility of the caller | |
| * references: https://css-tricks.com/building-interoperable-web-components-react/ | |
| * https://www.youtube.com/watch?v=vLkPBj9ZaU0 |
| // typing functions | |
| type FocusListener = (isFocussed: boolean) => void | |
| const addListener = (onFocusChanged: FocusListener) => { | |
| return true | |
| } | |
| // type object lietral map, can use | |
| const cache: { [id: string]: string } = { |
| import React, { useEffect, useState, useRef } from 'react'; | |
| import { | |
| Chart as ChartJS, | |
| CategoryScale, | |
| LinearScale, | |
| BarElement, | |
| Title, | |
| Tooltip, | |
| Legend, | |
| } from 'chart.js'; |
| const berries = ["blackberry", "raspberry", "strawberry"]; | |
| const citrus = ["orange", "lime", "mandarin"]; | |
| const melons = ["watermelon", "honeydew", "cantalopue"] | |
| let list = [ | |
| { | |
| name: "watermelon" | |
| }, | |
| { | |
| name: "orange" | |
| }, |
| // example of common basic custom hooks pattern | |
| // | |
| export default function useCounter() { | |
| const [counter, setCounter] = useState(0); | |
| useEffect(() => { | |
| // do something e.g. initialze things | |
| }, []) |
| * [Interesting Link] [interesting-link] | |
| * [Boring Link] [boring-link] | |
| [interesting-link]: https://github.com/interesting | |
| [boring-link]: https://github.com/boring |
| angular.module('directive.contact-brief' | |
| , []) | |
| .directive('contactBrief', [function(Events) { | |
| return { | |
| restrict: 'E', | |
| scope: { | |
| contact:'=contact' // we expect a contact object passed in | |
| }, | |
| templateUrl: '../contact-brief.html', | |
| replace: true, |
| .noTitleDialog .ui-dialog-titlebar { | |
| display:none; | |
| } |