Skip to content

Instantly share code, notes, and snippets.

View davatron5000's full-sized avatar
🚀
Making Luro

Dave Rupert davatron5000

🚀
Making Luro
View GitHub Profile
@davatron5000
davatron5000 / console.js
Created January 11, 2024 14:37
fueleconomy.gov scraper
$$('.mpgSummary:not(.ev) .context').map(mpg => parseInt(mpg.nextSibling.textContent))
.reduce((acc,curr) => acc + curr, 0) / $$('.mpgSummary:not(.ev) .context').length
const arr = $$('.p-media_transcript__scrollable > p').map((line) => {
return {
timestamp: line.querySelector('.p-media_transcript__timestamp').textContent,
text: line.querySelector('.p-media_transcript__text').textContent
}
});
function hhmmssToMillis(hhmmss) {
const time = hhmmss.split(':').reverse();
switch(time.length) {
[
{
"path": "/*",
"resourceSizes": [
{"resourceType": "script","budget": 350},
{"resourceType": "total","budget": 450}
]
}
]
document.querySelectorAll('.Box-row .js-navigation-open').forEach( (item) => {
const filename = item.textContent.toLowerCase();
const humanFiles = ['AUTHORS', 'CHANGELOG', 'CODE_OF_CONDUCT', 'CONTRIBUTING', 'LICENSE', 'README', 'TECHNOLOGY', 'TROUBLESHOOTING', 'SECURITY'];
const row = item.parentNode.parentNode.parentNode;
if((filename != 'src' && filename.endsWith('rc'))
|| filename.includes('config')
|| filename.includes('ignore')
|| filename.includes('.conf.js')
|| filename.includes('webpack')
|| filename == 'robots.txt'
---
layout: default
title: Archives
---
<div class="archive archive--has-year container">
<header class="archive-header">
<h1 class="title">The Archives</h1>
<p class="tags">I like to talk about:
{% for tag in collections.tagList %}
if(prop("Completed") / prop("Goal") == 0, "░░░░░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.1), "▓░░░░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.2), "▓▓░░░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.3), "▓▓▓░░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.4), "▓▓▓▓░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.5), "▓▓▓▓▓░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.6), "▓▓▓▓▓▓░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.7), "▓▓▓▓▓▓▓░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.8), "▓▓▓▓▓▓▓▓░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.9), "▓▓▓▓▓▓▓▓▓░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.99), "▓▓▓▓▓▓▓▓▓▓ ", if(prop("Completed") / prop("Goal") == 1, " 🏁", "")))))))))))) + format(round(prop("Completed") / prop("Goal") * 100)) + "%"
# - title:
# subtitle:
# author:
# img: https://images-na.ssl-images-amazon.com/images/P/#.01._SCLZZZZZZZ_.jpg
# url:
# rating:
# notes:
- year: 2018
books:
- title: Showa 1953-1989
@davatron5000
davatron5000 / popup.css
Last active September 19, 2021 01:42
Universal Popup Control
[aria-hidden="true"] { display: none; }
@davatron5000
davatron5000 / bashprompt
Last active May 25, 2018 17:46
My Custom Bash Prompt
# Make a bash prompt that looks like this:
# λ directory [master !?] $
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]; then
STAT=`parse_git_dirty`
// Vanilla version of FitVids
// Still licencened under WTFPL
//
// Not as robust and fault tolerant as the jQuery version.
// It's BYOCSS.
// And also, I don't support this at all whatsoever.
;(function(window, document, undefined) {
'use strict';