Skip to content

Instantly share code, notes, and snippets.

View noelleleigh's full-sized avatar

Noelle Leigh noelleleigh

View GitHub Profile
@noelleleigh
noelleleigh / sendAsQR
Created October 16, 2014 17:04
Bookmarklet: Generate QR Code From Current URL
javascript: (function() {window.open('https://duckduckgo.com/?q=!qr+'+document.URL,'_blank');})()
@noelleleigh
noelleleigh / multiRedditExportCopyPaste
Last active January 8, 2017 06:38
Produces a string for the multireddit that can be pasted into Alien Blue to easily import your current multireddits.
javascript: (function() {
const subredditsList = document.querySelector('.subreddits').childNodes;
let multiString = '';
subredditsList.forEach(listItem => {
const subName = listItem.firstChild.getAttribute('href').slice(3);
multiString += subName + '+';
});
const instructions = 'Copy this string and send it to your phone. \n\n\ \
In Alien Blue: \n\n \
1. Tap "Edit" \n \
@noelleleigh
noelleleigh / multiRedditExportQR
Last active August 29, 2015 14:08
Produces a QR code for the current multireddit. Scan with your phone to get the string and paste it into Alien Blue to easily import your multi.
javascript: (function() {
var ul_array = document.getElementsByClassName('subreddits').item(0).children;
var multiString = "";
for (var i = 0; i < ul_array.length; i++) {
var subName = ul_array[i].firstChild.firstChild.data.slice(3);
multiString += subName + "+";
}
window.open("http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl=" + encodeURIComponent(multiString), '_blank');
})()
@noelleleigh
noelleleigh / filterPins.user.js
Last active July 2, 2017 00:23
Adds buttons to Pinterest to allow filtering of certain annoying pins.
// ==UserScript==
// @name Filter Pins
// @namespace https://gist.github.com/noahleigh/
// @version 3.1.2
// @author Noah Leigh
// @description Add buttons that let the user toggle the visibility of certain pins on Pinterest.
// @homepage https://gist.github.com/noahleigh/0c71909a860d15ea56fd
// @match https://*.pinterest.com/*
// ==/UserScript==
@noelleleigh
noelleleigh / getVSIX.user.js
Created February 2, 2017 23:17
Bookmarklet to get .VSIX download link for Visual Studio Code extensions
javascript:(function(){
const regex = /https:\/\/marketplace\.visualstudio\.com\/items\?itemName=([\w-]+).([\w-]+)/;
const [, publisher, extensionName] = regex.exec(window.location.href);
const version = document.querySelector('table.ux-table-metadata > tbody > tr:nth-child(1) > td:nth-child(2) > div').textContent;
prompt(
'Open this link in a new tab and save as a .VSIX file:',
`https://${publisher}.gallery.vsassets.io/_apis/public/gallery/publisher/${publisher}/extension/${extensionName}/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage`
);
})();
@noelleleigh
noelleleigh / get_middle-earth_music.sh
Last active February 20, 2017 21:52
Download and extract some background music from http://middle-earth.thehobbit.com/ (requires jq)
#!/bin/bash
# Download and extract music from http://middle-earth.thehobbit.com/
# Get dmaf JSON file
dmaf_assets_url='http://middle-earth.thehobbit.com/stable.380729695375977266/assets/dmaf_assets/'
data=$(curl -s "$dmaf_assets_url"json/dmaf_data.json)
# Get the section of JSON that we're interested in
webaudio_loader_json=$(
echo $data |
@noelleleigh
noelleleigh / get_middle-earth_music.ps1
Created February 20, 2017 22:00
Download and extract some background music from http://middle-earth.thehobbit.com/
<#
.SYNOPSIS
Download and extract music from http://middle-earth.thehobbit.com/
#>
# Get dmaf JSON file
$dmaf_assets_url = 'http://middle-earth.thehobbit.com/stable.380729695375977266/assets/dmaf_assets/'
$data = Invoke-WebRequest -Uri ($dmaf_assets_url + 'json/dmaf_data.json') | ConvertFrom-Json
# Get the section of JSON that we're interested in
@noelleleigh
noelleleigh / getYahooQuestion.js
Last active November 15, 2017 18:11
Function for extracting the asker, question, and question details from Yahoo Answer question pages.
/** Pass an object with `asker`, `question`, and `details` properties for the given Yahoo Answers
* question page URL to the callback function.
*/
(function getYahooQuestion(url, callback) {
/** Error to throw when a user data ID cannot be found. */
class NoUserDataIdError extends Error {
constructor() {
super();
this.name = 'NoUserDataIdError';
@noelleleigh
noelleleigh / get_sunbeam.py
Last active October 27, 2017 15:22
Python 3 script for downloading all the pages of the webcomic On a Sunbeam (http://www.onasunbeam.com/). Requires Requests (http://docs.python-requests.org/) and Beautiful Soup 4 (https://www.crummy.com/software/BeautifulSoup/).
#!/usr/bin/env python3
'''Dowload the comic *On a Sunbeam*'''
import shutil
from urllib.parse import urljoin, urlparse
from os.path import basename
import requests
from bs4 import BeautifulSoup
def get_chapter_links(url):
@noelleleigh
noelleleigh / undefinedSin.js
Last active June 28, 2017 21:04
Implementation of Alex Yakushev's JavaScript type nightmare (https://twitter.com/unlog1c/status/879421477036183552) feat. a fun pun!
(function undefinedSin() {
// Save the original sine function
const originalSin = Math.sin;
// Encapsulate a scaled sine function
const sinScaled = function sinScaled(value, xScale, yScale) {
return originalSin((value * Math.PI) / xScale) * yScale;
};
// Function that returns a graph formed by the string representation of the input