Skip to content

Instantly share code, notes, and snippets.

View mgamini's full-sized avatar

Garrett Amini mgamini

View GitHub Profile
@mgamini
mgamini / hinter.js
Created November 18, 2020 22:56
Spelling Bee Hinter
var DOM = {
body: document.querySelector('body'),
parent: document.createElement('div'),
header: document.createElement('p'),
answerList: document.createElement('ul'),
refreshButton: document.createElement('button'),
hintParent: document.createElement('div'),
hintLabel: document.createElement('p'),
hintSlider: document.createElement('input')
}
@mgamini
mgamini / Cheater.js
Created November 18, 2020 21:59
Spelling Bee Cheater
var DOM = {
body: document.querySelector('body'),
parent: document.createElement('div'),
header: document.createElement('p'),
answerList: document.createElement('ul'),
refreshButton: document.createElement('button'),
}
DOM.parent.style.cssText = 'display: block; width: 100%; background: #eee; padding: 30px; position: absolute; top: 100%;';
DOM.header.style.marginBottom = '20px';
@mgamini
mgamini / wyomings.js
Last active November 6, 2020 15:25
Wyomings calculator
// Nav to the NYT election page:
// https://www.nytimes.com/interactive/2020/11/03/us/elections/results-president.html
// Open developer tools
// Paste the code below
// note: pasting code you don't understand into your browser is very dangerous.
// If you don't understand what this code is doing, don't do it.
const POP_OF_WYOMING = 578759
window.alert(`Biden is winning by ${([...document.querySelectorAll('.e-all-text')].reduce((arr, node) => Math.abs(arr - parseInt(node.innerText.replaceAll(',',''))), 0) / POP_OF_WYOMING).toFixed(2)} Wyomings`)
Most team sports have a depth chart (a ranking of each player) for each position they have. For Example in NFL: Ben Roethlisberger is listed as the starting QB and first on the QB depth chart. Landry Jones, his backup is listed as the 2nd person on that depth chart. We want to implement functionality that will manage these depth charts.
Data Model
Assume player objects look like this. Note that players can be on the depth chart for positions that are not their own.
{
"player_id": 1,
"name": "Bob",
"position": "WR"
}
Problems to solve (Not all need Completed):
@mgamini
mgamini / shortcut.js
Created March 20, 2019 19:38
Spelling Bee cheater iOS shortcut
var DOM = {
body: document.querySelector('body'),
parent: document.createElement('div'),
header: document.createElement('p'),
answerList: document.createElement('ul'),
refreshButton: document.createElement('button'),
}
DOM.parent.style.cssText = 'display: block; width: 100%; background: #eee; padding: 30px; position: absolute; top: 100%;';
DOM.header.style.marginBottom = '20px';
@mgamini
mgamini / parse.js
Last active October 23, 2020 14:26
Newsday Saturday Stumper AcrossLite Grid Parser
// Instructions:
// Open the Newsday Saturday Stumper in Firefox: https://www.newsday.com/entertainment/extras/crossword-puzzle-1.6375288
// Click on your selected puzzle to navigate to the puzzle page.
// Right-click (option click) anywhere on the puzzle. Select "This Frame -> Show Only This Frame".
// This should bring up just the puzzle.
// Right-click (option click) and click "Inspect Element". Enter the Console tab.
// Paste the code below, and press Enter. Save the text file, and open into Across Lite.
// PLEASE NOTE: EXECUTING CODE IN YOUR CONSOLE YOU DON'T UNDERSTAND IS GENERALLY A VERY BAD IDEA. Don't make a habit of this.
["Brooklyn Heights",
"Navy Yard",
"Admiral's Row",
"Cadman Plaza",
"Clinton Hill",
"Downtown Brooklyn",
"Bridge Plaza",
"RAMBO",
"DUMBO",
"Fort Greene",
This file has been truncated, but you can view the full file.
[
{
"id": 1040049997721620500,
"created_at": "2018-09-13 01:30:17",
"favorites": 1,
"retweets": 0,
"retweeted": "False",
"source": "Hootsuite Inc.",
"text": "At Green-Wood, 9/11 victims lie beside New York City legends https://t.co/UP7zE2eeRk https://t.co/Md5ZIVhecC"
},
@mgamini
mgamini / keybase.md
Last active August 29, 2015 14:11
keybase.md

Keybase proof

I hereby claim:

  • I am mgamini on github.
  • I am mgamini (https://keybase.io/mgamini) on keybase.
  • I have a public key whose fingerprint is F7F9 D6C5 D50A 5E9D 6447 6C0C 6220 86F7 FAC2 0231

To claim this, I am signing this object:

@mgamini
mgamini / ajaxspreadsheet.js
Last active September 20, 2021 23:15
How to receive ajax data and store it in a Google spreadsheet
// Follow the instructions here: http://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
//
// That'll get you 80% of the way there. Unfortunately, you'll run into CORS and MIMETYPE errors, so make the following changes.
// ============================================================
// Your clientside script should actually look like this (jquery example):
// ============================================================
var data = {email: "[email protected]"}