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
| # aliases | |
| alias -g ll='ls -al' | |
| alias -g subl='open -a "Sublime Text"' | |
| alias server='python3 -m http.server 8000 --bind 127.0.0.1' | |
| alias rmvenv='deactivate && rm -rf venv/' | |
| alias venv='python3 -m venv venv' | |
| alias activate='source venv/bin/activate' | |
| alias pipupgrade='python3 -m pip install --upgrade pip' | |
| alias requirements='python3 -m pip install -r requirements.txt' |
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><!-- This is a valid HTML5 document. --> | |
| <!-- Screen readers, SEO, extensions and so on. --> | |
| <html lang="en"> | |
| <!-- Has to be within the first 1024 bytes, hence before the `title` element | |
| See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset --> | |
| <meta charset="utf-8"> | |
| <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 --> | |
| <!-- The viewport meta is quite crowded and we are responsible for that. | |
| See: https://codepen.io/tigt/post/meta-viewport-for-2015 --> | |
| <meta name="viewport" content="width=device-width,initial-scale=1"> |
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
| /* | |
| Create or edit userChrome.css in your Firefox profile folder, | |
| typically found on Linux at ~/.mozilla/firefox/[some firefox profile folder]/chrome/userChrome.css | |
| */ | |
| .urlbarView-row[label]{ | |
| margin-block-start: 0 !important; | |
| } | |
| .urlbarView-row[label]::before{ |
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
| .PHONY:test | |
| test: | |
| rm -rf ./my-profile; mkdir ./my-profile && echo "user_pref('devtools.console.stdout.content', true);user_pref('dom.allow_scripts_to_close_windows', true);user_pref('datareporting.policy.firstRunURL', '');" > ./my-profile/user.js && firefox --headless -profile ./my-profile -no-remote `pwd`/index.html | sed -n "/console.log: /p" | sed -e 's/console.log: "//' -e 's/"$$//' | ./tapview |
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
| // WARNING: There's much more to know/do around hooks, and | |
| // this is just a simplification of how these work. | |
| // shared references, updated | |
| // per each hook invoke | |
| let execution = null; | |
| let current = null; | |
| let context = null; | |
| let args = null; |
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
| """ | |
| Implements a simple HTTP/1.0 Server | |
| """ | |
| import socket | |
| def handle_request(request): | |
| """Handles the HTTP request.""" |
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
| /* Applying it to the html element will provide smooth scrolling to anchors | |
| https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior */ | |
| html { | |
| scroll-behavior: smooth; | |
| } | |
| /* Remove animations for folks who set their OS to reduce motion. | |
| 1. Immediately jump any animation to the end point | |
| 2. Remove transitions & fixed background attachment |
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
| (function (context, trackingId, options) { | |
| const history = context.history; | |
| const doc = document; | |
| const nav = navigator || {}; | |
| const storage = localStorage; | |
| const encode = encodeURIComponent; | |
| const pushState = history.pushState; | |
| const typeException = 'exception'; | |
| const generateId = () => Math.random().toString(36); | |
| const getId = () => { |
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
| // Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
| // http://creativecommons.org/publicdomain/zero/1.0/ | |
| (function (win, doc) { | |
| // Cut the mustard. | |
| if (!win.localStorage) return; | |
| // You should probably use a more specific selector than this. | |
| var textarea = doc.querySelector('textarea'); | |
| // The key for the key/value pair in localStorage is the current URL. | |
| var key = win.location.href; |
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
| def neighborhood(iterable, first=None, last=None): | |
| """ | |
| Yield the (previous, current, next) items given an iterable. | |
| You can specify a `first` and/or `last` item for bounds. | |
| """ | |
| iterator = iter(iterable) | |
| previous = first | |
| current = next(iterator) # Throws StopIteration if empty. | |
| for next_ in iterator: |