Skip to content

Instantly share code, notes, and snippets.

@benedictchen
benedictchen / FirebaseCloudStoragePlugin.ts
Last active April 24, 2024 11:32
Firebase Cloud Storage Plugin for Uppy (File Uploader Library)
import { BasePlugin } from '@uppy/core'
import { Uppy, UppyOptions } from '@uppy/core';
import { getAuth } from 'firebase/auth';
import {
UploadTaskSnapshot,
getDownloadURL,
getStorage,
uploadBytesResumable,
ref,
} from 'firebase/storage';
@benedictchen
benedictchen / resetPackageLock.sh
Created July 26, 2018 22:04
Reset all `package-lock.json` files
git status | grep '^.modified' | cut -d: -f2- | sed -e 's/^...//' | grep *package-lock.json | xargs git checkout --
@benedictchen
benedictchen / calculateYouTubePlaylistHours.js
Created May 6, 2018 16:45
Calculate YouTube Playlist Total Duration
const x = Array.prototype.map.call(document.querySelectorAll('iron-list#items .style-scope ytd-thumbnail-overlay-time-status-renderer'), ((node)=>node.textContent.trim()))
var seconds = x.map((item)=> {
let itemParts = item.split(':');
let str = itemParts[itemParts.length - 1] || 0;
return parseInt(str);
}).reduce((prev, current) => prev + current);
var minutes = x.map((item)=> {
let itemParts = item.split(':');