tags |
---|
#placeholder #todo |
[!INFO] This note is a placeholder. It needs to be fleshed out.
// ==UserScript== | |
// @name Load random Stack Exchange network hot question | |
// @namespace http://edcottrell.com/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Ed Cottrell | |
// @include *://stackexchange.com* | |
// @grant none | |
// ==/UserScript== |
// This is useful for Google searches with date limitations. | |
// Based on the calculations at https://stackoverflow.com/a/11760121 | |
Date.prototype.getJulian = function() { | |
return Math.floor((this / 86400000) - (this.getTimezoneOffset() / 1440) + 2440588); | |
} | |
var yesterday = new Date(); //set any date | |
yesterday.setDate(yesterday.getDate() - 1); |
Birthday: $= '[[' + dv.current().birthday.toString().slice(0,10) + ']]'
($= moment().diff(moment(dv.current().birthday.toString()), 'years')
years old)
// Start with the clipboard content | |
var result = TextExpander.pasteboardText; | |
// If the result is wrapped in quotation marks... | |
if (result.match(/^"[\s\S]+"$/)) { | |
result = result.replace(/^"|"$/g, '') // Strip the leading and trailing quotation marks | |
.replace(/""/g, '"'); // And replace any doubled quotation marks ('""') with just one ('"') | |
} | |
// Return the result |
// Start with the clipboard content | |
var result = TextExpander.pasteboardText; | |
// Use ONE of the following three code lines to format the number | |
// As xxx-xxx-xxxx | |
result = result.replace(/^[(). –-]*(\d\d\d)[(). –-]*(\d\d\d)[(). –-]*(\d\d\d\d)[(). –-]*(?: *x *(\d+))?$/, '[$1-$2-$3 x$4](tel:$1$2$3p$4)'); | |
// As xxx.xxx.xxxx | |
// result = result.replace(/^[(). –-]*(\d\d\d)[(). –-]*(\d\d\d)[(). –-]*(\d\d\d\d)[(). –-]*(?: *x *(\d+))?$/, '[$1.$2.$3 x$4](tel:$1$2$3p$4)'); | |
// As (xxx) xxx-xxxx |
function toTitleCase(text) { | |
var wordsToLeaveInLowerCase = [ | |
'a', | |
'about', | |
'above', | |
'after', | |
'again', | |
'against', | |
'an', | |
'and', |
// Attempt to clean up messy OCR output (in English) from the clipboard by fixing broken paragraphs, | |
// removing clutter from page headers and footers, and correcting a few other common glitches. | |
// It's always a good idea to read over whatever OCRed content you're pasting, but this helps me often. | |
// Start with the clipboard content | |
var text = TextExpander.pasteboardText; | |
// helper function to escape special characters modified from https://stackoverflow.com/questions/3115150/how-to-escape-regular-expression-special-characters-using-javascript |
// Get the URL for the Internet Archive history (if any) for the | |
// URL currently on the system clipboard | |
// Start with the clipboard content | |
var result = TextExpander.pasteboardText; | |
result = 'https://web.archive.org/web/*/' + result; | |
// Return the result | |
TextExpander.appendOutput(result); |