Skip to content

Instantly share code, notes, and snippets.

View elcrostatina's full-sized avatar
👽
I don't belive in humans

elcrostatina elcrostatina

👽
I don't belive in humans
View GitHub Profile
@elcrostatina
elcrostatina / client-info.decorator.ts
Created April 9, 2023 20:39
Nest custom decorator to get user-agent and ip address from a request
export interface ClientInfoHeaders {
userAgent: string;
ipAddress: string;
}
/**
* Decorator for getting client info from request.
*
* @example
* @decorator @Get()
* public async myMethod(@ClientInfo() clientInfo: { userAgent: string; ipAddress: string })
@elcrostatina
elcrostatina / capacitor-firebase.helper.ts
Last active May 19, 2023 22:46
Capacitor Firebase Helper
import firebase from 'firebase/compat';
import { SignInResult } from '@capacitor-firebase/authentication';
import { FirebaseAuthenticationPlugin } from '@capacitor-firebase/authentication/dist/esm/definitions';
export type FirebaseEmailPasswordProvider =
FirebaseAuthenticationPlugin['signInWithEmailAndPassword'];
export type LoginProviderResponse =
| Promise<SignInResult>
| FirebaseEmailPasswordProvider
@elcrostatina
elcrostatina / TypeScript NonFunctionProperty
Last active June 6, 2022 23:43
Type to extract only the properties that are not function
// type NonFunctionPropertyNames<T> = {
// [K in keyof T]: T[K] extends () => void ? never : K;
// }[keyof T];
type NonFunctionPropertyNames<O> = {
[K in keyof O]: O[K] extends Function ? never : K;
}[keyof O];
export type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;

Keybase proof

I hereby claim:

  • I am elcrostatina on github.
  • I am elcrostatina (https://keybase.io/elcrostatina) on keybase.
  • I have a public key ASCBbkilg34mEc3LCxrt8vFNlTFI9Az8qSKl0Lvg0dFX6Ao

To claim this, I am signing this object: