Skip to content

Instantly share code, notes, and snippets.

View Gbuomprisco's full-sized avatar
🚀
Building stuff

Giancarlo Buomprisco Gbuomprisco

🚀
Building stuff
View GitHub Profile
@Gbuomprisco
Gbuomprisco / supabase-cookie-strategy.ts
Last active November 1, 2023 16:59
An implementation of a possible strategy for cookie handling
@Gbuomprisco
Gbuomprisco / session.json
Created July 10, 2022 22:26
Fixture for working with stripe-mock
{
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
@Gbuomprisco
Gbuomprisco / emulator-admin-firebase.ts
Created November 21, 2020 23:32
Firebase Emulator Admin function
import * as admin from 'firebase-admin';
import Credential = admin.credential.Credential;
// replace this with your configuration
const DATABASE_URL = 'localhost:5003';
const FIRESTORE_URL = 'localhost:5002';
const AUTH_URL = 'localhost:9099';
const PROJECT_ID = 'firebase-project-id'; // replace with your project ID
export function initializeEmulatorAdmin(
@Gbuomprisco
Gbuomprisco / observed.ts
Last active November 6, 2021 05:21
Typescript Decorator to automatically mark a component dirty with Angular Ivy
// tslint:disable
import { Observable, Subscription } from 'rxjs';
import { Type, ɵComponentType as ComponentType, ɵmarkDirty as markDirty } from '@angular/core';
interface ComponentDefinition {
onInit(): void;
onDestroy(): void;
}
const repositoryTextInput = document.querySelector('#repositoryName');
const repositoriesElement = document.querySelector('#repositories');
const SEARCH_URL = 'https://api.github.com/search/repositories?q=';
const cache = new Map();
const repositoryNameChanges$ = fromEvent(repositoryTextInput, 'input').pipe(
map(e => e.target.value)
);
const repositoryTextInput = document.querySelector('#repositoryName');
const repositoriesElement = document.querySelector('#repositories');
const SEARCH_URL = 'https://api.github.com/search/repositories?q=';
const repositoryNameChanges$ = fromEvent(repositoryTextInput, 'input').pipe(
map(e => e.target.value)
);
const stopClicked$ = fromEvent(stopElement, 'click');
@Gbuomprisco
Gbuomprisco / nx-nest-ssr-webpack.config.js
Last active August 25, 2019 11:35
nx-nest-ssr config
const webpack = require('webpack');
const path = require('path');
const WebpackConfigFactory = require('@nestjs/ng-universal').WebpackConfigFactory;
const config = WebpackConfigFactory.create(webpack, {
server: './apps/api/src/main.ts'
});
config.output = {
path: path.join(__dirname, './dist'),
@Component({
selector: 'toggle',
template: `{{ value }}`,
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => ToggleComponent),
multi: true
}]
})
export class ToggleComponent implements ControlValueAccessor {
<div class='mt-5'>
<crypto-selector (selected)="onCryptoSelected($event)"></crypto-selector>
<div class='price'>
{{ price$ | async }}
</div>
<ng-container *ngIf="(price$ | async) === undefined && (currency$ | async)">
<div class='alert alert-info mt-2'>
Awaiting for Price...
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class AppComponent {
public price$: Observable<string | undefined>;
public currency$ = new BehaviorSubject<string | undefined>(undefined);