Skip to content

Instantly share code, notes, and snippets.

Madly deprecating Python 2.

Alice Zoë Bevan–McGregor amcgregor

Madly deprecating Python 2.
Block or report user

Report or block amcgregor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
amcgregor /
Last active Aug 12, 2019
A very, very brief explanation of the WSGI request/response flow.

User's browser formualtes the following request:

GET / HTTP/1.1

The request is parsed by something (FELB like Nginx, etc.) and passed through to the application process in some manner, e.g. HTTP reverse proxy, FastCGI binary socket, uWSGI, etc. Upon hitting the WSGI application, the Python side host reformulates the request:

amcgregor / punt-ugly.js
Last active Aug 15, 2019
JavaScript / ES6 sufficient to polyfill missing window.console (wholesale, or specific missing methods), identify local development vs. production, squelch certain logging operations in production, and rote console interactions (in non-file: protocol environments) to the back-end server for archival, analytics, etc.
View punt-ugly.js
"use strict";!function(){const e=new RegExp("^"+["([^.].)+local","([^.].)+example","([^.].)+test","([^.].)+internal","([^.].)*localhost","","::1"].join("|")+"$","i"),o="file:"==window.location.protocol||e.test(window.location.hostname),i=()=>{},n=(e,...o)=>{fetch(`/meta/collect/${e}`,{method:"POST",mode:"same-origin",cache:"no-cache",credentials:"same-origin",redirect:"error",referrer:"client",headers:{"Content-Type":"application/json"},body:JSON.stringify({args:o})})},t=["assert","clear","count","countReset","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeLog","timeStamp","timeline","timelineEnd","trace","warn"],r=["debug","error","exception","info","log","table","trace","warn"],l=["debug","info","log"];var c=window.console=window.console||{},a={};for(let e of t)c[e]||(c[e]=i.bind(c));if(!o)for(let e of l)c[e]=i.bind(c);if("file:"!=window.location.protocol)for(let e of r)a[e]=c[e],l.includ
amcgregor / 404.html
Last active Jul 29, 2019
My own HTML5 boilerplate sans most of the code. Because there's too much Romulus-be-damned boilerplate, and people fail to realize almost none of it is in any way needed. For more details than you probably wanted, ref:
View 404.html
<!DOCTYPE html>
<html lang="en">
<title>Page Not Found</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<h1>Page Not Found</h1>
<p>Sorry, but the page you were trying to view does not exist.</p>
amcgregor /
Last active Jul 15, 2019
An impressive number of endpoint arguments, comparing Flask vs. WebCore for the same endpoint. Identifying "boilerplate" / "overhead" involved in typecasting and validation.
## Flask ("Regular Expression URL Routes")
def handler(lat, lon, time, altitude, speed, bearing, accuracy):
# It's so explicit, you have to define the entire arglist twice!
# It's very specific about int vs. float, not matching integer like numbers for floating point components at all.
View cloudapp-export.rb
#!/usr/bin/env ruby
# A quick script to download all your files from CloudApp.
# To run this just run the script passing your e-mail & password
# to the script, for example:
# sudo gem install cloudapp_api
# ruby cloudapp-export.rb passwoed
amcgregor /
Last active Jul 12, 2019
Search on for "FUD warning", it descends quickly. The comment of mine marked as spam, but replied to anyway, was this.

best designed

Best is a very unfortunate word to use. Illegal in some countries to call a given solution the best, interestingly, as it's too easy to be trivially wrong if badly scoped, making such statements false or misleading advertising.

I don't get why you're clinging to the stability argument. Layout without CSS is technically more stable than using CSS (layout things are being added to CSS all the time, HTML less so). So would you conclude that we should avoid CSS altogether? I assume (well, hope) not. You take into account what browsers support.

Argumentum ad absurdum. In fact, I do design my apps to be functional and usable without styling, and without JavaScript. Case example: <details> vs. megabytes of jQuery JS and Bootstrap CSS to utilize disconnected un-semantic DIVs which, without JS but with CSS, entirely obfuscate (hide) their content. I test under lynx and elinks2 to get a perspective on the pages I'm working on that shares more in common with spiders and sc

amcgregor /
Last active Jul 15, 2019
A comparison of supplying default arguments to endpoints between Flask and WebCore.
from datetime import datetime
from flask import Flask
app = Flask(__name__)
def time():
amcgregor / die-jquery-die.js
Last active Jul 3, 2019
If your first instinct is to give a jQuery answer to a CSS question, stop. Please stop. Especially stop before you start arguing in jQuery's favour in this day and age. We have, and can do better.
View die-jquery-die.js
// Okay, this is a thing. A StackOverflow Answer thing.
// Answering the question: "how do I use CSS to make a span not clickable"
$('a span:nth-child(2)').click(function(event) { event.preventDefault(); });
// Because that's *totally* using CSS.
// (Spoiler, it's pointer-events: none.)
// Comment on that answer points this out, gets this response:
// Those of us who work in jQuery tend to give examples in jQuery because it's


A hosted SAAS job offer distribution platform.



System-wide components required for operation in development:

from marrow.schema import Attribute
from marrow.schema.validate import Validator
from marrow.schama.validate.exc import Concern
class EqualsOther(Validator):
"""Ensure the value used matches an existing value from another attribute on the same object."""
other = Attribute()
def validate(self, value, context):
You can’t perform that action at this time.