Skip to content

Instantly share code, notes, and snippets.

@Benjol
Benjol / RenameUser.user.js
Created Nov 28, 2012
Rename users (especially ones with 'default' names)
View RenameUser.user.js
// ==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 Feb 14, 2012
Project reference-fixing macros for Visual Studio
View ProjectMacros.vb
' 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 / nonbreakspaces.user.js
Created Sep 2, 2011
Non-break-space userscript for StackExchange
View nonbreakspaces.user.js
// ==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");
View selfupdatingscript.user.js
// ==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 / racecarpuzzle.fsx
Created Mar 10, 2011
First attempt at implementing Tom Siergedas's solution to the question at http://stackoverflow.com/q/4075289
View racecarpuzzle.fsx
//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 / autoreviewcomments.user.js
Last active Sep 25, 2015
Add pro-forma comments dialog for reviewing (pre-flag)
View autoreviewcomments.user.js
// ==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*
@Benjol
Benjol / futurereview.user.js
Created Feb 18, 2011
User script to change Unanswered tab to Review in StackOverflow and StackExchange (except gaming)
View futurereview.user.js
// ==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/*
You can’t perform that action at this time.