Skip to content

Instantly share code, notes, and snippets.

View jasonreiche's full-sized avatar

Jason Reiche jasonreiche

  • Rio Salado College (Maricopa)
  • Tempe, Arizona, USA
View GitHub Profile
(()=> {
// Add a pink background to all headings
const s = document.createElement("style");
s.innerText = "h1, h2, h3, h4, h5, h6 { background-color: pink; }";
document.head.appendChild(s);
// Spell check and make content editable
document.body.contentEditable = true;
document.body.spellcheck = true;
@jasonreiche
jasonreiche / copyGoogleGroupsMemberNames.js
Last active November 17, 2023 19:37
Copies all the Names from the current Google Groups Membership page into the clipboard
/**
* Snippet that can be run on a Google Group membership list to get a list that can be pasted into a spreadsheet.
* Paste and then rerun on each page of members to get full list. Includes names.
*/
// Version 1
copy([...document.querySelectorAll('div[aria-label="Group Members"] > div:not(:first-child) > div > span:nth-child(1) > div[jsslot] div > div:nth-child(1) > div')].map(e=>e.innerText).join('\n'));
// Version 2
copy([...document.querySelectorAll("div[aria-label='Group Members'] > div[role='row']")].map(row => row.innerText.replaceAll("\n", "\t")).join("\n"))
@jasonreiche
jasonreiche / get_unique_styles.js
Created December 3, 2021 07:55
Get unique styles assigned to any element matching a query selector
[...document.querySelectorAll("#targets")].forEach(targetEl => {
var targetStyles = window.getComputedStyle(targetEl);
var comparisonEl = document.createElement(targetEl.tagName);
var comparisonStyles = window.getComputedStyle(comparisonEl);
var cleanStyles = {};
Object.entries(targetStyles).forEach(style=>{
if(comparisonStyles[style[0]] !== style[1]){
cleanStyles[style[0]] = style[1];
}
});

Keybase proof

I hereby claim:

  • I am jasonreiche on github.
  • I am jasonreiche (https://keybase.io/jasonreiche) on keybase.
  • I have a public key ASBRchzZLWP3_0VuyGCP1vVPBQ6UXuGYPJGOxlL0xjpuewo

To claim this, I am signing this object:

@jasonreiche
jasonreiche / hreflang.css
Last active January 26, 2021 21:52
Show language of links after the link if an hreflang attribute is set.
/* Show language of links if non-English -
Language Codes: https://www.w3schools.com/tags/ref_language_codes.asp
*/
a[hreflang]:after {
color: #555; /* Change \ supersede to match theme as needed */
content: " [" attr(hreflang) "]"; /* Fallback to showing hreflang as content if match isn't found below */
vertical-align: super;
font-size: 70%;
}
a[hreflang^= 'ab']:after { content: ' [Abkhazian]'; }
@jasonreiche
jasonreiche / kbd-keys.css
Created January 26, 2021 21:46
Make KDB HTML elements look more like a keyboard key
kbd {
padding: 0.05em 0.4em;
border: 1px solid #ccc;
font-size: 11px;
font-family: Arial, Helvetica, sans-serif;
background-color: #eee;
color: #222;
-moz-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2), 0 0 0 2px #ffffff inset;
-webkit-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2), 0 0 0 2px #ffffff inset;
box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2), 0 0 0 2px #ffffff inset;
@jasonreiche
jasonreiche / reduceTableToMaxCols.js
Last active January 5, 2021 20:20
Reduce a table to a maximum number of columns
const maxCol = 2;
const table = document.querySelector("table#target");
// Use an array spread to quickly iterate rows in table
[...table.getElementsByTagName("TR")].forEach(row => {
// delete all columns beyond max
while (row.children.length > maxCol) {
row.children[maxCol].remove();
}
})
@jasonreiche
jasonreiche / GetFileMetaProps.vbs
Last active July 11, 2020 05:04
Get all meta data from a file and put it in a Dictionary object
'objItem in this example would be a Scripting.FileSystemObject passed into a function
Dim objShell, objFolder, objFolderItem, objProps
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(objItem.ParentFolder.Path) ' File folder path without filename.
Set objFolderItem = objFolder.ParseName(objItem.Name) ' Filename without path.
set objProps = CreateObject("Scripting.Dictionary")
On Error Resume Next
For i = 0 To 512