Skip to content

Instantly share code, notes, and snippets.

View lvabarajithan's full-sized avatar
🚀
Never stop learning

Abarajithan Lv lvabarajithan

🚀
Never stop learning
View GitHub Profile
@lvabarajithan
lvabarajithan / utility_types.ts
Last active May 24, 2023 14:47
Typescript - Prettify intelli-sense, Make certain fields from type T as partial & others as required and group-by array elements type
/**
* Prettify the hover output of a type
*/
export type Prettify<T> = {
[K in keyof T]: T[K]
} & {}
/**
* Make certain fields from T as partial
*/
@lvabarajithan
lvabarajithan / index.js
Created April 26, 2020 11:32
Structuring the Firebase Cloud functions and triggers to scale
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const glob = require('glob');
admin.initializeApp(functions.config().firebase);
/**
* Cloud triggers
*/
const files = glob.sync('./triggers/**/*.f.js', {cwd: __dirname});
@lvabarajithan
lvabarajithan / FileLoggingTree.java
Last active May 15, 2020 14:50
Log to file reactively in Android using RxJava and Timber
/**
* Writes logs to the file every 5 sec
* or a maximum of 10 count is reached (which ever is first)
*/
public class FileLoggingTree extends Timber.DebugTree {
private static final SimpleDateFormat LOG_DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss.SSS aa");
private static final SimpleDateFormat FILE_DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy");
private Relay<String> logBuffer = ReplayRelay.<String>create().toSerialized();