Birthday: $= '[[' + dv.current().birthday.toString().slice(0,10) + ']]'
($= moment().diff(moment(dv.current().birthday.toString()), 'years')
years old)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toTitleCase(text) { | |
var wordsToLeaveInLowerCase = [ | |
'a', | |
'about', | |
'above', | |
'after', | |
'again', | |
'against', | |
'an', | |
'and', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Stack Overflow Badge Info for Moderator Election Candidates | |
// @namespace https://github.com/edcottrell/ | |
// @version 0.2.0 | |
// @description Shows a prettier breakdown of the candidate's badges that contribute to candidate score | |
// @author Ed Cottrell | |
// @license MIT | |
// @match *://*.askubuntu.com/election* | |
// @match *://*.mathoverflow.net/election* | |
// @match *://*.serverfault.com/election* |
NewerOlder