Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Dan Burzo danburzo

View GitHub Profile
@danburzo
danburzo / youtube-favorites.js
Created Jul 18, 2018
Grab a JSON of your YouTube favorite videos (or any other playlist)
View youtube-favorites.js
/*
Get your Youtube favorite videos
--------------------------------
1. Navigate to your Favorites page
2. Scroll the list all the way down such that all videos are loaded into the browser.
3. Copy the JavaScript code below and run it in your console; a JSON of your videos
will be loaded into your clipboard.
4. Paste into a file on your computer.
@danburzo
danburzo / index.js
Created Feb 25, 2017
Find the WordPress themes & plugins used by a page
View index.js
function _match(str, regex) {
var matches = [];
str.replace(regex, function() {
matches.push(Array.prototype.slice.call(arguments));
});
return matches;
}
function _unique(item, idx, arr) {
return arr.indexOf(item) === idx;
@danburzo
danburzo / README.md
Last active Feb 7, 2019
Scrape your Facebook saved links
View README.md

Facebook does not provide an easy way to get your saved links out of its system. Here's a quick script that does that for you.

Instructions

Go to your Saved links page and make sure you scroll way down to the bottom so that all your saved items are loaded. This script will generate a simple HTML page with your links, along with an Add to Pinboard action.

Bookmarklet

Drag this to your bookmarks toolbar: <a href='javascript:eval(unescape("//%20selector%20for%20accessing%20the%20links%0A//%20%28this%20might%20be%20subject%20to%20change%29%0Avar%20ITEM_SELECTOR%20%3D%20%22._4bl9%20%3E%20a%3Afirst-child%22%3B%0A%0Avar%20elements%20%3D%20%5B%5D.slice.call%28document.querySelectorAll%28ITEM_SELECTOR%29%29%3B%0A%0Avar%20items%20%3D%20elements.map%28function%28element%29%20%7B%20%0A%09%0A%09var%20title%20%3D%20element.textContent.trim%28%29%3B%0A%09var%20href%20%3D%20element.getAttribute%28%27href%27%29%3B%20%0A%0A%09//%20clean%20up%20weird%20links%0A%09if%20%28href.indexOf%28

@danburzo
danburzo / README.md
Last active Jan 19, 2016
Draw every emoji
View README.md
@danburzo
danburzo / README.md
Last active Jun 10, 2018
Duplicate pinboard bookmarks
View README.md

Finding duplicate Pinboard bookmarks.

Run this Node script against your exported JSON file, which you'll need to enter in the FILEPATH variable.

The keyfor method returns the relevant part of the URL. You can customize it based on the available properties.

@danburzo
danburzo / smartypants.js
Last active Nov 9, 2016
Smartypants in JavaScript
View smartypants.js
function smartypants(str) {
/*
Rules adapted from:
http://www.leancrew.com/all-this/2010/11/smart-quotes-in-javascript/
*/
return [
[/(^|[-\u2014\s(\["])'/g, "$1\u2018"], // opening single quote
[/'/g, "\u2019"], // closing single quote, apostrophe
[/(^|[-\u2014/\[(\u2018\s])"/g, "$1\u201c"], // opening double quote
[/"/g, "\u201d"], // closing double quote
@danburzo
danburzo / event-listeners.js
Last active Apr 1, 2019
Get all event listeners on the page in Google Chrome
View event-listeners.js
var items = Array.prototype.slice.call(
document.querySelectorAll('*')
).map(function(element) {
var listeners = getEventListeners(element);
return {
element: element,
listeners: Object.keys(listeners).map(function(k) {
return { event: k, listeners: listeners[k] };
})
};
You can’t perform that action at this time.