Skip to content

Instantly share code, notes, and snippets.

View jadeallencook's full-sized avatar
🤙
Send it

Jade Allen Cook jadeallencook

🤙
Send it
View GitHub Profile
const rows = document.querySelectorAll('tr.mat-mdc-row');
let emailByUid = {};
for (const row of [...rows]) {
const email = row.querySelector('td:nth-child(1)').innerText;
const uid = row.querySelector('td:nth-child(5)').innerText;
if (email && uid) emailByUid[uid] = email;
}
@jadeallencook
jadeallencook / install-tensorflow.sh
Created January 25, 2024 03:07
Shell script to get up and going with Tensorflow.
# test if python is installed
if [ -z "$(which python)" ]; then
# if not installed then install python
echo "Python is not installed. Installing python..."
sudo apt-get install python
echo "Python installed successfully."
fi
# test if homebrew is installed
if [ -z "$(which brew)" ]; then
# your info here
GITHUB_USERNAME="your_username"
AUTHOR_NAME="Your Name"
INIT_COMMIT_MESSAGE="init: setup basic react app using webpack and typescript"
# create-react-app
git clone "git@github.com:$GITHUB_USERNAME/$1.git"
cd "$1"
# create package.json
@jadeallencook
jadeallencook / pull-request.sh
Last active August 9, 2023 01:21
Shell script to standardize pull request descriptions.
#!/bin/bash
# 1. Install hub on your machine (https://hub.github.com)
# 2. Add this file to your project and update your package.json
# "scripts": {
# "pull-request": "sh ./path/pull-request.sh"
# }
# 3. Run "npm run pull-request" to open a pull request
REMOTE=$(echo `git remote get-url origin` | sed -e 's/.*:\(.*\)\/.*/\1/')
@jadeallencook
jadeallencook / semaphore-scraper.js
Last active April 11, 2024 22:21
This script automatically captures and logs the positional changes of Adobe's San Jose Semaphore discs in real-time, stops after reaching a predefined limit, and exports the logged data for further analysis.
/*
Adobe Semaphore Data Capture
Author: @jadeallencook
Date: May 13, 2023
This script captures the position sequences of the semaphore wheels from the Adobe Semaphore public art installation.
The script queries the semaphore's website, maps the transform styles of the wheel elements to their positions,
and stores the sequences of positions in an array. The script logs every captured sequence, and logs the progress
every 10 sequences. Once the script has captured a predetermined maximum number of sequences, it logs the entire
@jadeallencook
jadeallencook / instagram-preview.js
Created July 23, 2022 04:13
preview image post on your instagram feed
const insert = (type, result) => {
const base64 = `data:${type};base64,${btoa(result)}`;
const rows = document.querySelectorAll('div._ac7v');
let images;
let clone = document.querySelector('div._ac7v > div._aabd').cloneNode();
clone.innerHTML = '';
clone.style.background = `url(${base64})`;
clone.style.backgroundPosition = 'center center';
clone.style.backgroundSize = 'cover';
for (let row of rows) {
@jadeallencook
jadeallencook / robinhood-stats.js
Created April 17, 2020 04:47
Paste into your browser to generate a stock report.
let investments = 0;
let loses = 0;
let gains = 0;
let down = [];
let up = [];
document
.querySelectorAll('span.theme-closed-down')
.forEach(elem => {
investments++;
@jadeallencook
jadeallencook / flatten.js
Created May 22, 2019 01:08
Recursive ES6 function that flattens an array.
const flatten = array => array.reduce((temp, value) => temp.concat(Array.isArray(value) ? flatten(value) : value), []);
// example
console.log(flatten([[['str']],undefined,null,{},[[true,false],[{},[]],[],{}],[],[],[],[]]));
@jadeallencook
jadeallencook / copy-youtube-playlist.js
Created January 27, 2019 23:42
Copy playlists faster by only having to click the video number!
document.querySelectorAll('#index').forEach(elem => {
elem.style.cursor = 'pointer';
elem.onclick = function() {
menu = this.parentNode;
this.style.color = 'red';
menu.querySelectorAll('#button')[0].click();
document.querySelectorAll('paper-listbox#items')[0].children[1].click();
document.querySelector('.checkbox-height[title="YOUR PLAYLIST NAME"]').click();
}
});
@jadeallencook
jadeallencook / react-input-state-sync.js
Last active December 23, 2018 11:36
Easily sync your inputs to your state with this event handler.
import merge from 'lodash/merge';
export default function rjsBind(event) {
const path = event.target.getAttribute('data-path'),
paths = path.split('-'),
value = event.target.value;
let object = {};
paths.reduce(([object, value], path, idx) => {
object[path] = idx === paths.length - 1 ? value : {};
return [object[path], value];