Skip to content

Instantly share code, notes, and snippets.

View anish2690's full-sized avatar

Anish George anish2690

View GitHub Profile
@anish2690
anish2690 / clipbard.js
Created October 14, 2020 05:13
copy to clipboard
const copyToClipboard = str => {
const el = document.createElement('textarea');
el.value = str;
el.setAttribute('readonly', '');
el.style.position = 'absolute';
el.style.left = '-9999px';
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
@anish2690
anish2690 / firestore_cursor.js
Created September 22, 2021 05:36 — forked from navidshad/firestore_cursor.js
Read all data from Firestore by a cursor and resolve the Bandwidth Exhausted error
/*
How can we read all data from a firestore collection?
HI guys I want to show you how.
I had these problems for reading all data from a firestore collection:
1. firestore cursor is not proper as a powerful cursor as to be able make this task done.
2. after few thousands request you will get Bandwidth Exhausted error.
For doing this task we need two things and each one can helps us resolve above problems:
1. A powerfull cursor
Vue.prototype.$forceCompute= function(computedName, forceUpdate /* default: true */) {
if (this._computedWatchers[computedName]) {
this._computedWatchers[computedName].run();
if (forceUpdate || typeof forceUpdate == 'undefined') this.$forceUpdate()
}
}
this.$forceCompute('title')
this.$forceCompute('title', false) // No force update