Skip to content

Instantly share code, notes, and snippets.

View bel0v's full-sized avatar
🌵

Yegor bel0v

🌵
View GitHub Profile
@mbleigh
mbleigh / README.md
Last active November 3, 2024 19:49
Firebase Hosting Fetch All Files

Fetch All Files from Firebase Hosting

This script fetches all of the files from the currently deployed version of a Firebase Hosting site. You must be signed in via the Firebase CLI and have "Site Viewer" permission on the site in question to be able to properly run the script.

Running via NPX

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>
@bschwartz757
bschwartz757 / async.js
Last active November 15, 2023 03:23
Async/await function to fetch data from multiple URLs in parallel
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
// parse results as json; fetch data response has several reader methods available:
//.arrayBuffer()
@scottwb
scottwb / number_with_delimiter.js
Created February 11, 2011 04:10
Rails-like number_with_delimiter in javascript
Number.prototype.number_with_delimiter = function(delimiter) {
var number = this + '', delimiter = delimiter || ',';
var split = number.split('.');
split[0] = split[0].replace(
/(\d)(?=(\d\d\d)+(?!\d))/g,
'$1' + delimiter
);
return split.join('.');
};