This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var digitToNum = digit => ({v:digit, f:`${digit}`}) | |
var partitions = x => times(i => [take(i+1, x), drop(i+1, x)], x.length - 1) | |
const negop = {o:(a) => ({o:negop, a, v:-a.v, f:`-${a.f}`})} | |
const unops = [negop] | |
const addop = {o:curry((a,b) => ({o:addop, a, b, v:a.v+b.v, f:`${a.f}+${b.f}`}))} | |
const subop = {o:curry((a,b) => ({o:subop, a, b, v:a.v-b.v, f:`${a.f}-${b.f}`}))} | |
const mulop = {o:curry((a,b) => ({o:mulop, a, b, v:a.v*b.v, f:`${a.f}x${b.f}`}))} | |
const divop = {o:curry((a,b) => (b.v != 0 ? {o:divop, a, b, v:a.v/b.v, f:`${a.f}/${b.f}`} : null))} | |
const biops = [addop, subop, mulop, divop] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(() => { | |
const observer = new MutationObserver(addFormatControls) | |
observer.observe(document.querySelector('body'), {attributes: true, subtree: true}) | |
function getCommentInput (optionsElement) { | |
return $(optionsElement).closest('.comment-box').find('textarea').get(0) | |
} | |
function wrapSelection (input, wrap) { | |
const selection = input.value.slice(input.selectionStart, input.selectionEnd) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(`<style> | |
.fp-album-wrapper:not(:hover) .fp-track-listing { | |
display: none; | |
margin-left: -0.5em; | |
} | |
.album-title .fp-track-listing { | |
position: absolute; | |
z-index: 1; | |
} | |
.fp-track-listing { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Similar to JSON.stringify but limited to a specified depth (default 1) | |
// The approach is to prune the object first, then just call JSON.stringify to do the formatting | |
const prune = (obj, depth = 1) => { | |
if (Array.isArray(obj) && obj.length > 0) { | |
return (depth === 0) ? ['???'] : obj.map(e => prune(e, depth - 1)) | |
} else if (obj && typeof obj === 'object' && Object.keys(obj).length > 0) { | |
return (depth === 0) ? {'???':''} : Object.keys(obj).reduce((acc, key) => ({ ...acc, [key]: prune(obj[key], depth - 1)}), {}) | |
} else { | |
return obj |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Change New Releases page to a complete text listing with hover images | |
if (window.location.pathname === '/homes/new_releases') { | |
$('<style>\ | |
.videos-shadow-container { display: none; }\ | |
.my-top-100-page { height: auto; }\ | |
.album-shadow-container > .album-scrollable { display: none; }\ | |
.album-shadow-container > button { display: none; }\ | |
.album-shadow-container + h3 { display: none; }\ | |
.hnr-at { border-spacing: 3px; border-collapse: separate; margin-left: -3px; font-family: "Helvetica Neue", sans-serif; }\ | |
.hnr-at .album-link img {position: absolute; }\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Bookmarkleteer</title> | |
<script> | |
/** | |
* Bookmarklet Compiler | |
* | |
* Inspired by Moxley Stratton - http://www.moxleystratton.com/ | |
*/ |
NewerOlder