Skip to content

Instantly share code, notes, and snippets.

View mogsdad's full-sized avatar

David Bingham mogsdad

View GitHub Profile
@mogsdad
mogsdad / Roomba-VTZ.user.js
Last active September 25, 2015 02:47
Presents a set of buttons to quickly down-vote questions & answers for automatic deletion. (AKA Roomba candidates) See documentation:http://stackapps.com/questions/6599/roomba-vtz-vote-to-zero.
// ==UserScript==
// @name Roomba-VTZ (Vote-to-zero)
// @namespace https://gist.github.com/mogsdad/ed30af363a376ec4a1c2
// @version 1.2
// @description Presents a set of buttons to quickly down-vote questions & answers for automatic deletion. (AKA Roomba candidates)
// @author David Bingham (Mogsdad)
// @include /^https?://(meta\.)?(stackoverflow|stackexchange|serverfault|superuser|askubuntu|stackapps)\.com/questions/[0-9]+.*/
// @grant none
// ==/UserScript==
@mogsdad
mogsdad / zapHelpAndImrovement.user.js
Created October 1, 2015 18:28
I don't enjoy the Help and Improvement review queue on SO, so I don't want to see it anymore!
// ==UserScript==
// @name zapHelpAndImrovement
// @namespace zapHelpAndImrovement
// @description Suppress the Help and Improvement review queue
// @include http://stackoverflow.com/review
// @version 1
// @grant none
// ==/UserScript==
$('div').has('a[href="/review/helper"]').closest('.dashboard-item').remove();
@mogsdad
mogsdad / loadReview.user.js
Last active October 2, 2015 20:51
When on a Stack Exchange network review tab, periodically checks whether there is a review available.
// ==UserScript==
// @name Load review
// @namespace https://gist.github.com/mogsdad/50c5a3e9686cf0a8867f
// @version 1.2
// @description When on a Stack Exchange network review tab, periodically checks whether there is a review available.
// @author David Bingham (Mogsdad)
// @include /^https?://(meta\.)?(stackoverflow|stackexchange|serverfault|superuser|askubuntu|stackapps)\.com/review/*/
// @grant none
// ==/UserScript==
@mogsdad
mogsdad / FindMyLastChatMsg.user.js
Created October 30, 2015 14:29
Find user's last posted message in a StackExchange chat room
// ==UserScript==
// @name FindMyLastChatMsg
// @author Mogsdad
// @contributor Siguza
// @namespace chat.stackoverflow
// @description Find user's last posted message in a StackExchange chat room
// @include /^https?://chat.(stackoverflow|stackexchange|serverfault|superuser|askubuntu|stackapps)\.com/rooms/.*/
// @version 1.0.0.0
// @grant none
// ==/UserScript==
// ==UserScript==
// @name Stack Overflow Real Dark
// @namespace http://github.com/TinyGiant/
// @description Real dark styling for Stack Overflow and some Stack Exchange sites
// @author @TinyGiant
// @run-at document-start
// @version 1.0.1.1m
// @include /^https?:\/\/.*\.?stack(overflow|exchange).com/.*$/
// ==/UserScript==
@mogsdad
mogsdad / TidyGoogleFormResponses.js
Last active December 14, 2015 02:38
With Google forms, responses are saved into a spreadsheet. You may want to remove some or all responses, but there's no form API that allows that. This gist contains a function that can remove some or all responses, starting with the first (oldest) one. This works with the legacy forms product (pre-February 2013). This was written in response to…
/**
* Delete form response rows. If no input parameter is provided, prompt user
* for the number of form response rows to remove. To remove all rows, input
* -1.
*
* Assumes that the form responses are in the active sheet, that there is one
* row of 'headers' followed by responses (starting in row 2).
*
* @param {number} thisMany (Optional) The number of rows to remove. If not
* specified, user will be prompted for input.
@mogsdad
mogsdad / gist:5045148
Last active December 14, 2015 06:48 — forked from mhawksey/gist:1643207
Replaced isDate() with a version that can more accurately detect Date objects, and will not interpret integers as dates.
// EventManagerV3 glued together by mhawksey http://www.google.com/profiles/m.hawksey
// Related blog post http://mashe.hawksey.info/eventmanagerv3/
// With some code (settings, importIntoCalendar, sendEmails) from
// Romain Vialard's http://www.google.com/profiles/romain.vialard
// Manage your events: Calendar Importer and Registration Form
// https://spreadsheets.google.com/ccc?key=tCHuQkkKh_r69bQGt4yJmNQ
var ss = SpreadsheetApp.getActiveSpreadsheet();
var BOOKING_ACTION_COL = 10;
@mogsdad
mogsdad / appsScriptSaveSpeed.js
Created March 1, 2013 15:05
This gist contains a Google Apps Script that performs some experiments to provide comparisons between data storage options. It was written in response to StackOverflow question [What is faster: ScriptDb or SpreadsheetApp?](http://stackoverflow.com/questions/15145918/what-is-faster-scriptdb-or-spreadsheetapp)
/**
* Run experiments to measure speed of various approaches to saving data in
* Google App Script (GAS).
*/
function testSpeed() {
var numObj = 400;
var numAttr = 10;
var doFlush = false; // Set true to activate calls to SpreadsheetApp.flush()
var arr = buildArray(numObj,numAttr);
@mogsdad
mogsdad / ForwardHuntGroup.js
Created April 13, 2013 05:18
This script was written as the answer to a StackOverflow question about forwarding emails to a rotating list of people. See http://stackoverflow.com/a/15984468/1677912.
/**
* Retrieves a given user label by name and forwards unread messages
* associated with that that label to a member of the Hunt Group.
*/
function huntGroupForward() {
// get the label for given name
var labelName = "elephant"
var label = GmailApp.getUserLabelByName(labelName);
if (label == null) throw new Error("No messages for label "+labelName);
// get count of all threads in the given label
@mogsdad
mogsdad / uniqueFrom.js
Created January 9, 2014 18:48
Javascript Array extension to find the members of a set (array) that are unique, that is they are not members of other sets. See http://goo.gl/ArHbvb.
/**
* Returns a non-destructive Array of elements that are not found in
* any of the parameter arrays.
*
* @param {...Array} var_args Arrays to compare.
*/
Array.prototype.uniqueFrom = function() {
if (!arguments.length)
return [];
var a1 = this.slice(0); // Start with a copy