This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"feed": [ | |
{ | |
"post": { | |
"uri": "at://did:plc:tbo4hkau3p2itkar2vsnb3gp/app.bsky.feed.post/3lap626df4c2n", | |
"cid": "bafyreicrgscmzup5b5c45iygnqqtrfzkqcq6m3cyyx347qblr6gdzs6x6q", | |
"author": { | |
"did": "did:plc:tbo4hkau3p2itkar2vsnb3gp", | |
"handle": "thomasfuchs.at", | |
"displayName": "Thomas Fuchs 🔭🕹️", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { ActorRefFrom, AnyActorRef, AnyStateMachine, SnapshotFrom } from 'xstate'; | |
import { useMachine, useSelector } from '@xstate/react'; | |
type MachineStateFrom<T extends AnyStateMachine | AnyActorRef> = [ | |
state: SnapshotFrom<T>, | |
send: ActorRefFrom<T>['send'], | |
actor: ActorRefFrom<T>, | |
]; | |
export function useActorFromRef<T extends AnyActorRef>(ref: T): MachineStateFrom<T> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const fs = require('fs'); | |
const { Project, SyntaxKind } = require('ts-morph'); | |
async function main() { | |
const project = new Project(); | |
const glob = path.join(process.cwd(), './**/(src|test)/**/*.{ts,tsx,js}'); | |
project.addSourceFilesAtPaths(glob); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createCaseFromEvent(result, variables, cache) { | |
const readEvent = () => | |
cache.readFragment( | |
gql` | |
fragment _ on CaseManagementEvent { | |
id | |
cases { | |
id | |
status | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
refresh_interval: 30 # seconds | |
max_price: 700 # dollars | |
urls: | |
- https://www.canadacomputers.com/product_info.php?cPath=43_557_559&item_id=184760 | |
- https://www.canadacomputers.com/product_info.php?cPath=43_557_559&item_id=185988 | |
- https://www.canadacomputers.com/product_info.php?cPath=43_557_559&item_id=184759 | |
- https://www.canadacomputers.com/product_info.php?cPath=43_557_559&item_id=184431 | |
- https://www.canadacomputers.com/product_info.php?cPath=43_557_559&item_id=185087 | |
- https://www.canadacomputers.com/product_info.php?cPath=43_557_559&item_id=185751 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as x from './xstate-fp'; | |
export enum EditableTextState { | |
idle = 'idle', | |
editing = 'editing', | |
} | |
export enum EditableTextEvent { | |
mouseenter = 'mouseenter', | |
mouseleave = 'mouseleave', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const connect = (mapState, mapActions) => Component => { | |
const store = useStore(mapState); | |
const actions = useActions(mapActions); | |
return function Wrapped(props) { | |
return <Component {...props} {...store} {...actions} />; | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AddTodo() { | |
const [text, setText] = useState(''); | |
const save = useActions(actions => actions.add); | |
const handleAddClick = async () => { | |
await save(text); | |
setText(''); | |
}; | |
const handleTextChange = e => setText(e.target.value); | |
return ( | |
<div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function App() { | |
const fetchTodos = useActions(actions => actions.fetchTodos); | |
useEffect(() => { | |
fetchTodos(); | |
}, [fetchTodos]); | |
return ( | |
<div> | |
<h1 style={{ margin: 0 }}>Todo</h1> | |
<Todos /> | |
<AddTodo /> |
NewerOlder