Skip to content

Instantly share code, notes, and snippets.

View ezzabuzaid's full-sized avatar
🎯
Focusing

ezzabuzaid ezzabuzaid

🎯
Focusing
View GitHub Profile
---
projectName: "HTTP trigger project"
extensions: "core,identity,hono,fly,postgresql"
---
```ts
export default project(
feature('InventoryFeature', {
policies: {
cambodiaClient: policy.country('Cambodia'),
projectName extensions
HTTP trigger project
core,identity,hono,fly,postgresql,github
export default project(
  feature('products', {
    tables: {
 issues: table({
projectName extensions
Firebase Authentication
core,identity,hono,fly,postgresql,firebase-auth
export default project(
  feature('products', {
    policies: {
 isAuthenticated: policy.authenticated(),
projectName extensions
HTTP trigger project
core,identity,hono,fly,postgresql
export default project(
	feature('Users', {
		tables: {
 users: table({
@ezzabuzaid
ezzabuzaid / todo.ts
Last active August 13, 2024 12:35
Todo API using Canon DSL
export default project(
feature('Todo', {
tables: {
tasks: table({
fields: {
title: field({ type: 'short-text', validations: [mandatory()] }),
completed: field({ type: 'boolean' }),
},
}),
},
@ezzabuzaid
ezzabuzaid / morph-inject.ts
Last active April 22, 2024 15:47
Migrate constructor injection to the new inject function.
import * as morph from 'ts-morph';
/**
* By default any component, directive, pipe, or service that have superclass is discarded
*
* If you want to permit some superclasses.
*/
const ALLOWED_SUPER_CLASSES: string[] = [];
export function resizeObservable(
element: HTMLElement,
options: ResizeObserverOptions = {}
): Observable<ResizeObserverEntry[]> {
return new Observable((observer) => {
const resizeObserver = new ResizeObserver((records) => {
observer.next(records);
});
resizeObserver.observe(element, options);
return () => {
@ezzabuzaid
ezzabuzaid / dotnet.env.js
Created February 23, 2024 10:57
DOT_NET env var style in nodejs
const env = require('dotenv').config();
const deepmerge = require('deepmerge');
const { parsed: object } = env;
let clone = {};
for(const key in object) {
if(Object.hasOwnProperty.call(object, key)) {
const value = object[key];
if(key.includes('__')) {
const keys = key.split('__');
@ezzabuzaid
ezzabuzaid / loading$.ts
Last active February 23, 2024 11:01
Extract loading state from observable
import {
Observable,
ObservableInput,
ReplaySubject,
delay,
distinctUntilChanged,
finalize,
from,
of,
tap,
import internal, { PassThrough, Transform } from 'stream';
export function concatStreams({
streams,
delimiter,
}: {
delimiter?: string;
streams: (() => internal.Readable)[];
}) {
const destination = new PassThrough({ objectMode: true });