Skip to content

Instantly share code, notes, and snippets.

@benedictchen
benedictchen / calculateYouTubePlaylistHours.js
Created May 6, 2018
Calculate YouTube Playlist Total Duration
View calculateYouTubePlaylistHours.js
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(':');
@benedictchen
benedictchen / resetPackageLock.sh
Created Jul 26, 2018
Reset all `package-lock.json` files
View resetPackageLock.sh
git status | grep '^.modified' | cut -d: -f2- | sed -e 's/^...//' | grep *package-lock.json | xargs git checkout --