[DRAFT] U.S. Obscenity Ban: Name & Blame

An 1873 federal bill to ban smut, abortion pamphlets, and sex toys was never found unconstitutional; instead, only the clauses that meaningfully impacted the ability of the American public to be sexually promiscuous were overturned, piecemeal, under the banner of "civil rights". I will attempt to give a breakdown (including partisan affiliation) of the people behind this bill's tortured history.

Javascript: getElementByXPath

function getElementByXPath(path, context=null, document=null, namespaceResolver=null, first_ordered=true) {
  if (context === null) context = window.document.documentElement;
  if (document === null) document = context.ownerDocument;
  if (namespaceResolver === null) namespaceResolver = document.createNSResolver(context);
  const result = document.evaluate(path, context, namespaceResolver, first_ordered ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_UNORDERED_NODE_TYPE, null);
  return result.singleNodeValue || null;
}

Getting OpenNIC to work with pfSense

If you're using an alternate DNS root server such as OpenNIC, and your network uses a pfSense-based router, you may find that clients are, strangely, unable to resolve unofficial TLDs, getting SERVFAIL or NXDOMAIN. There are 3 ways I can think of to quickly solve this problem for the whole network, listed here in increasing order of complication: 1. Disable the DNS resolver Go to Services > DNS Resolver …

Applying highlight.js to inline code on WordPress

If you're using the plugin Prismatic to apply highlight.js to your code excerpts, but you want it to also affect inline <code> tags (i.e. not only those wrapped in <pre> blocks), simply go Settings > Prismatic > Highlight.js and paste this into the “Init Script” field: hljs.configure({ cssSelector: 'code' }); hljs.highlightAll(); — then be sure to remember to add the language-* classes to your inline <code> tags! You may …

Mandates ARE laws…

I've seen some people online saying variations on “[COVID-19 quarantine] mandates aren't laws! know your rights! [state] legislature didn't sign off on this!” However, these people are usually incorrect. I'll be compiling examples in this post, more to come if I feel like it, starting out with representative examples from each quadrant of the U.S.: AL Code § 22-2-2 (6) [archived] CA HSC § 120130 (c) and (d), and …

Basic JS Async Cookbook

function asleep(delay) { return new Promise(resolve => setTimeout(resolve, delay)); } // Usage: await asleep(1000); function aalert(message) { return new Promise( resolve => resolve(alert(message)) ); } function aconfirm(message) { return new Promise( resolve => resolve(confirm(message)) ); } function aprompt(message, deflt) { return new Promise( resolve => resolve(prompt(message, deflt)) ); } // Usage: await aalert("The task will begin as soon as you press OK.") ; do_task(); aalert("The task will begin as …