Skip to content

Instantly share code, notes, and snippets.

View bennettmcelwee's full-sized avatar

Bennett McElwee bennettmcelwee

View GitHub Profile
@bennettmcelwee
bennettmcelwee / lesswrong_print.user.js
Last active September 28, 2015 13:28
User Script for formatting Less Wrong articles for printing
// ==UserScript==
// @name Less Wrong print formatter
// @version 1.0.1
// @namespace http://thunderguy.com
// @description Remove cruft from LessWrong when printing
// @include http://lesswrong.com/*
// ==/UserScript==
// Add required GM APIs if they aren't present (they were broken in Chrome 27)
if ( ! GM_addStyle) {
@bennettmcelwee
bennettmcelwee / manifest.json
Last active September 30, 2015 10:48
User script: Add a select list to WordPress edit pages to make it easy to set a publication date in the past
{
"manifest_version": 2,
"content_scripts": [ {
"exclude_globs": [ ],
"include_globs": [ "BLOG_URL/wp-admin/post*" ],
"js": [ "script.js" ],
"matches": [ "http://*/*", "https://*/*" ],
"run_at": "document_idle"
} ],
"converted_from_user_script": true,
@bennettmcelwee
bennettmcelwee / dabblet.css
Created March 9, 2012 01:30
Pure CSS menu demo
/* Pure CSS menu demo */
body {
font-family: "Trebuchet MS", sans-serif;
font-size: 30px;
line-height: 1.4
}
/* CSS 2 */
.menu-bar {
background-color: #666;
@bennettmcelwee
bennettmcelwee / dabblet.css
Created March 9, 2012 01:32
Pure CSS menu demo result
/**
* Pure CSS menu demo result
*/
html {
height: 100%;
}
body {
font-family: "Trebuchet MS", sans-serif;
font-size: 30px;
@bennettmcelwee
bennettmcelwee / svnup
Created November 20, 2012 22:07
Script for checking in a git revision to SVN
#!/bin/bash
# Use this with the Git-SVN workflow
# See http://thunderguy.com/semicolon/2012/01/25/a-spoonful-of-git-helps-the-subversion-go-down/
# Use this when getting ready to commit to SVN:
# > git checkout master
# > svnup
# git rebase master yourBranch
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" ||
@bennettmcelwee
bennettmcelwee / google-link-cleaner.user.js
Created December 4, 2012 04:02
Google link cleaner
@bennettmcelwee
bennettmcelwee / bookup.js
Created July 16, 2013 05:58
Chrome extension to allow lookup of books in Amazon and Fishpond
// Copyright (c) 2013 Bennett McElwee. All rights reserved.
// This is a Chrome extension.
// The onClicked callback function.
function onClickHandler(info, tab) {
// console.log("Info: " + JSON.stringify(info));
if (info.menuItemId == "bookup-amazon-to-fishpond") {
var isbn = getAmazonIsbn(info.pageUrl);
chrome.tabs.update(tab.id, {url: getFishpondUrl(isbn)});
} else if (info.menuItemId == "bookup-fishpond-to-amazon") {
@bennettmcelwee
bennettmcelwee / bookmarkleteer.html
Last active December 19, 2015 20:58
Web page that can turn Javascript into a bookmarklet
<!DOCTYPE html>
<html>
<head>
<title>Bookmarkleteer</title>
<script>
/**
* Bookmarklet Compiler
*
* Inspired by Moxley Stratton - http://www.moxleystratton.com/
*/
@bennettmcelwee
bennettmcelwee / wordpress-quick-pick.php
Created July 27, 2015 04:05
WordPress plugin that adds a Quick Date Picker to the New/Edit Post screen
<?php
/**
* Add a popup menu to the post screen that allows you to quickly choose a date within the last two weeks.
*
* @wordpress-plugin
* Plugin Name: Date Quick Pick
* Plugin URI: http://thunderguy.com/bennett/
* Description: Quickly choose a post date for posts.
* Version: 1.0.0
* Author: Bennett McElwee
if [ -f ~/bin/sensible.bash ]; then
source ~/bin/sensible.bash
fi
if [ -f ~/bin/git-completion.bash ]; then
source ~/bin/git-completion.bash
fi
export EDITOR="open -t -n -W"