Skip to content

Instantly share code, notes, and snippets.

View brandonroberts's full-sized avatar

Brandon Roberts brandonroberts

View GitHub Profile
@brandonroberts
brandonroberts / products.route.ts
Created August 23, 2022 15:26
Generated Route Config - Option 2
import { Component } from '@angular/core';
import { provideState } from '@ngrx/store';
export const routeConfig = {
title: 'Page Title',
providers: [
provideState()
]
}
@brandonroberts
brandonroberts / products.route-config.ts
Last active August 23, 2022 15:27
Generated Route config - Option 1
export default {
title: 'Page Title',
providers: [
provideState()
]
}
@brandonroberts
brandonroberts / 1.ngx-reactify.tsx
Created August 16, 2022 13:24 — forked from lacolaco/1.ngx-reactify.tsx
A React component to render a standalone Angular component (Angular v14.2 is required)
import { ComponentRef, createComponent, Type } from "@angular/core";
import { createApplication } from "@angular/platform-browser";
import React, { useEffect, useRef, useState } from "react";
type AnyComponentRef = ComponentRef<unknown>;
export type ReactifyProps = {
component: Type<unknown>;
inputs?: Record<string, unknown>;
};
@brandonroberts
brandonroberts / ngrx.ts
Created May 6, 2022 13:30 — forked from alxhub/ngrx.ts
ngrx add features example
function configureStoreWithFeature(feature: ...): Provider[] {
return [
{
provide: Store,
useFactory: () => {
const rootStore = inject(RootStore);
for (const feature of inject(STORE_FEATURE, [])) {
rootStore.registerFeature(feature);
}
return rootStore;
@brandonroberts
brandonroberts / index.js
Created March 1, 2022 15:05
Appwrite Function V2
const sdk = require('node-appwrite');
const fetch = require('node-fetch');
const { Headers, Request, Response } = require('node-fetch');
if (!globalThis.fetch) {
globalThis.fetch = fetch;
globalThis.Headers = Headers;
globalThis.Request = Request;
globalThis.Response = Response;
}
@brandonroberts
brandonroberts / index.js
Last active March 1, 2022 15:04
Appwrite Function V2
const sdk = require('node-appwrite');
const fetch = require('node-fetch');
const { Headers, Request, Response } = require('node-fetch');
if (!globalThis.fetch) {
globalThis.fetch = fetch;
globalThis.Headers = Headers;
globalThis.Request = Request;
globalThis.Response = Response;
}
@brandonroberts
brandonroberts / package.json
Last active March 1, 2022 14:55
Appwrite Function deps
{
"name": "appwrite-function",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
@brandonroberts
brandonroberts / index.js
Created February 28, 2022 19:34
Appwrite Function
const sdk = require("node-appwrite");
/*
'req' variable has:
'headers' - object with request headers
'payload' - object with request body data
'env' - object with environment variables
'res' variable has:
'send(text, status)' - function to return text response. Status code defaults to 200
@brandonroberts
brandonroberts / models.md
Last active January 21, 2022 12:56
Appwrite Models
@brandonroberts
brandonroberts / selectors.ts
Created November 17, 2021 13:56
Selectors - NgRx 13
export const selectProductListViewModel = createSelector(
selectIsViewReady,
selectProductsList,
(ready, products) => ({ ready, products })
);