Skip to content

Instantly share code, notes, and snippets.

View guptahitesh121's full-sized avatar

guptahitesh121

View GitHub Profile
const deepDeleteDoc = async (store: admin.firestore.Firestore, docPath: string, batchSize: number): Promise<any> => {
const doc = store.doc(docPath);
const snap = await doc.get();
if (!snap.exists) return;
console.log('Found doc - ' + docPath);
// Check if this doc has subcollections
const subCollections = await snap.ref.listCollections();
const promises: Promise<void>[] = [];
if (subCollections) {
for (const subCollection of subCollections) {
typedef Future<List<String>> OnChanged(String text);
class TypeAheadTextField extends StatefulWidget {
final OnChanged onChanged;
final ValueChanged onSelect;
TypeAheadTextField({this.onChanged, this.onSelect});
@override
_TypeAheadTextFieldState createState() => _TypeAheadTextFieldState();
@guptahitesh121
guptahitesh121 / ProxyLogger.js
Last active July 28, 2020 16:19
A Node js server which receives network request and response information from the client and saves it in files. Files are named in such a way that it is easier to find a request and response information of a particular http request.
const express = require('express');
var bodyParser = require('body-parser');
var fs = require("fs");
const app = express();
const port = 3000;
app.use(bodyParser.json({ limit: '50mb' }));
app.listen(port, () => console.log(`Logger Proxy Server is listening on port ${port}`));
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Swipe Demo',
@guptahitesh121
guptahitesh121 / tinder_card.dart
Created February 27, 2020 11:28
Sample Flutter code for swipe to dismiss animation like tinder app. Stack orientation can be changed by implementing `PositionBuilder` class. This also supports pagination when swiping cards with a progress widget if response is delayed.
import 'dart:math';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@guptahitesh121
guptahitesh121 / animated_card_swipe.dart
Last active March 4, 2020 14:27
Flutter animated swipe to remove sample code. Cards can be dismissed by swiping left or right with animation.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Swipe Demo',
debugShowCheckedModeBanner: false,
@guptahitesh121
guptahitesh121 / two_finger_swipe.dart
Last active September 14, 2022 06:14
Flutter Sample code to detect 2 finger swipe vertically using `RawGestureDetector` and `MultiDragGestureRecognizer`.
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Swipe Demo',
@guptahitesh121
guptahitesh121 / vs.config
Last active January 29, 2020 11:46
VS code configuration
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"tslint.autoFixOnSave": false,
"git.enableSmartCommit": true,
"php.validate.executablePath": "php",
"editor.fontSize": 13,
"explorer.openEditors.visible": 0,
"editor.tabCompletion": true,
"php-cs-fixer.onsave": true,
"php-cs-fixer.executablePath": "${extensionPath}\\php-cs-fixer.phar",