Skip to content

Instantly share code, notes, and snippets.

Brian-McBride / executor.ts
Created December 14, 2023 18:41
Nx using Astro Advanced APIs (Build)
import { writeFileSync } from 'fs';
import { resolve } from 'path';
import type { ExecutorContext } from '@nx/devkit';
import {
} from '@nx/devkit';
import { createLockFile, createPackageJson, getLockFileName } from '@nx/js';
Brian-McBride / example.ts
Created June 21, 2023 18:20
React Query with XState
export function useStateHook() {
const machineRef = useActorRef(userStateMachine);
const result = trpcReact.user.getById.useQuery('someUserId', {
onSettled(data, error) {
if (error) {
type: 'FETCH_ERROR',
Brian-McBride /
Last active June 9, 2023 20:23
XState Actor Manager

Actor Manager

The goal here is to be able to dynamically add and spawn actors within xstate.

Items of Note

  • The id provdied will be the one that resolved on the system object for system.get(id) calls from other actors.
  • There isn't a lot of garbage colleciton or the concept of removing actors yet
  • This probably works best with other full state machines
  • Sending a message to a machine not spawed isn't captured or buffered in any way. The event errors or is lost.
Brian-McBride /
Last active October 18, 2021 15:45
firebase-admin v10 with Jest 27 inside @nrwl/nx monorepo

firebase-admin + jest + nx

Using the new v10 firebase-admin libs with Jest v27 and Nx monorepos


Jest does not support the exports keyword within package.json fully. Proper support is expected in Jest 28

Will solve this error when updating to the new firebase-admin import methods

Brian-McBride /
Last active February 15, 2020 18:53

This is a start to get ArangoDB as a connector for FeathersJS


You'll need a few npm packages.

yarn add arangojs
yarn add uuid
yarn add clone-deep
Brian-McBride /
Last active January 16, 2018 22:30
Using swagger yaml files for validation in FeathersJS

This process will allow you to use Swagger Yaml files for validation. I've only tried this with REST endpoints, however it seems this should work with real-time sockets as well.


You'll need a few npm packages.

yarn add swagger-tools
var _ = require('/lib/underscore');
*This is the lightweight version I use based on Kevin Whinnery's one:
* Wrapper for Titanium UI components. This wrapper provides a few pieces of critical
* functionality, currently missing from Titanium UI objects:
* - The ability to safely extend components with new members
* - Rudimentary resource management and object lifecycle handling