Skip to content

Instantly share code, notes, and snippets.

@Benjol
Benjol / futurereview.user.js
Created February 18, 2011 10:13
User script to change Unanswered tab to Review in StackOverflow and StackExchange (except gaming)
// ==UserScript==
// @name FutureReview
// @author benjol
// @version 1.0.1
// @description Hack Unanswered tab to point to review
// @include http://stackoverflow.com/*
// @include http://meta.stackoverflow.com/*
// @include http://*.stackexchange.com/*
// @include http://meta.*.stackexchange.com/*
// @exclude http://*.gaming.stackexchange.com/*
@Benjol
Benjol / racecarpuzzle.fsx
Created March 10, 2011 08:28
First attempt at implementing Tom Siergedas's solution to the question at http://stackoverflow.com/q/4075289
//http://stackoverflow.com/questions/4075289/race-car-puzzle
// shuffle an array (in-place)
let rand = new System.Random()
let shuffle a =
let swap (a: _[]) x y =
let tmp = a.[x]
a.[x] <- a.[y]
a.[y] <- tmp
Array.iteri (fun i _ -> swap a i (rand.Next(i, Array.length a))) a
@Benjol
Benjol / selfupdatingscript.user.js
Created March 17, 2011 09:33
SelfUpdatingUserScript
// ==UserScript==
// @name SelfUpdatingScript
// @version 1.0.0
// @namespace Benjol (http://stackoverflow.com/users/11410/benjol)
// @description Template script for a self-updating script
// @credits Kudos to http://stackoverflow.com/users/115866/balpha
// @include https://gist.github.com/*
// ==/UserScript==
function with_jquery(f) {
@Benjol
Benjol / nonbreakspaces.user.js
Created September 2, 2011 06:15
Non-break-space userscript for StackExchange
// ==UserScript==
// @name NonBreakSpaces+
// @namespace benjol
// @description Make Ctrl-space add a non-break-space in textareas
// @include http://french.stackexchange.com/questions/*
// @include http://meta.french.stackexchange.com/questions/*
// @include http://chat.stackexchange.com/rooms/1098/*
// ==/UserScript==
function inject(f) {
var script = document.createElement("script");
@Benjol
Benjol / RenameUser.user.js
Created November 28, 2012 12:46
Rename users (especially ones with 'default' names)
// ==UserScript==
// @name RenameUser
// @namespace benjol
// @description Rename users (especially ones with 'default' names)
// @include http://stackoverflow.com/*
// @include http://meta.stackoverflow.com/*
// @version 1.0.0
// ==/UserScript==
function with_jquery(f) {
@Benjol
Benjol / ProjectMacros.vb
Created February 14, 2012 06:15
Project reference-fixing macros for Visual Studio
' These macros can be used to automatically swap between project and file references when adding/removing projects from a solution.
' When adding a new project to a solution, all the existing projects (and the new project) are scanned to see if there
' are existing file references to the project. If so, the file reference will be updated to a project reference.
' Conversely, when removing a project, if the macro can file a dll on the references path which has the same name as the removed
' project, it will change the project reference to a file reference.
' There are a few idiosyncrasies to be aware of: in my environment, all projects build to a common folder, so the macro will set references
' to 'No Copy', 'Any version', EXCEPT for 'Test' projects
' (Note that not all project types are supported)
' This code won't update a project when it is removed (impossible to save a project when it's already 'gone')
@Benjol
Benjol / autoreviewcomments.user.js
Last active February 4, 2022 18:34
Add pro-forma comments dialog for reviewing (pre-flag)
// ==UserScript==
// @name AutoReviewComments
// @namespace benjol
// @version 1.3.1
// @description Add pro-forma comments dialog for reviewing (pre-flag)
// @grant none
// @include http*://*stackoverflow.com/questions*
// @include http*://*stackoverflow.com/review*
// @include http*://*stackoverflow.com/admin/dashboard*
// @include http*://*stackoverflow.com/tools*