Skip to content

Instantly share code, notes, and snippets.

Avatar

Bennett McElwee bennettmcelwee

View GitHub Profile
@bennettmcelwee
bennettmcelwee / wordpress-quick-pick.php
Created Jul 27, 2015
WordPress plugin that adds a Quick Date Picker to the New/Edit Post screen
View wordpress-quick-pick.php
<?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
@bennettmcelwee
bennettmcelwee / lesswrong_print.user.js
Last active Sep 28, 2015
User Script for formatting Less Wrong articles for printing
View lesswrong_print.user.js
// ==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 Sep 30, 2015
User script: Add a select list to WordPress edit pages to make it easy to set a publication date in the past
View manifest.json
{
"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,
View dabblet.css
/* 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 Mar 9, 2012
Pure CSS menu demo result
View dabblet.css
/**
* Pure CSS menu demo result
*/
html {
height: 100%;
}
body {
font-family: "Trebuchet MS", sans-serif;
font-size: 30px;
@bennettmcelwee
bennettmcelwee / svnup
Created Nov 20, 2012
Script for checking in a git revision to SVN
View svnup
#!/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 / bookup.js
Created Jul 16, 2013
Chrome extension to allow lookup of books in Amazon and Fishpond
View bookup.js
// 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 Dec 19, 2015
Web page that can turn Javascript into a bookmarklet
View bookmarkleteer.html
<!DOCTYPE html>
<html>
<head>
<title>Bookmarkleteer</title>
<script>
/**
* Bookmarklet Compiler
*
* Inspired by Moxley Stratton - http://www.moxleystratton.com/
*/
View allmusic-search.html
<title>Search</title>
<script>
const name = 'AllMusic.com';
const baseUrl = 'http://www.allmusic.com/';
const searchRel = 'search/all/';
var s = window.prompt('Search ' + name, '');
window.location.href = s ? baseUrl + searchRel + s : baseUrl;
</script>
@bennettmcelwee
bennettmcelwee / search.html
Last active Feb 11, 2016
Show a search menu
View search.html
<title>Search</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
.hide { display: none; }
.search, #term, #go {
display: block;
font: 20px/50px sans-serif;
width: 100%;