Skip to content

Instantly share code, notes, and snippets.

View DenverCoder1's full-sized avatar
👨‍💻
Always learning!

Jonah Lawrence DenverCoder1

👨‍💻
Always learning!
View GitHub Profile
@DenverCoder1
DenverCoder1 / checkRedditUser.gs
Last active August 9, 2021 16:52
Google Apps Script to check if a given Reddit user exists.
// check if a reddit user exists using response code
// returns "TRUE" if they exist
// returns Error message if 404 response
function checkUser(input) {
// check that the input is a string
if (typeof user == 'string' && user.length) {
// open cache service for caching results
var cache = CacheService.getScriptCache();
// remove u/ and trailing spaces from username to normalize inputs
var user = input.replace(/^\/?(user|u|U)\//, "").trim();
<?php
// Get the contents of a URL
function curl_get_contents($url): string
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $url);
# Pig Latin Translator in Python
# Jonah Lawrence
# January 2020
import re
def translate(message: str) -> str:
"""translate a message to pig latin"""
@DenverCoder1
DenverCoder1 / settings.jsonc
Last active November 24, 2021 15:11
My VS Code Theme Customizations
{
"workbench.colorTheme": "Cobalt2",
"workbench.iconTheme": "material-icon-theme",
"workbench.colorCustomizations": {
"editor.lineHighlightBackground": "#0088aa20",
"editor.lineHighlightBorder": "#0088aa20",
"editorCursor.foreground": "#00ffd5",
"editor.background": "#00141d",
"editorGutter.background": "#00141d",
"editor.selectionBackground": "#00ffff55",
@DenverCoder1
DenverCoder1 / Chrome Dino Hacks.js
Last active May 7, 2021 06:27
Simple ways to cheat in the chrome://dino game
/* Chrome://dino Hacks
* Jonah Lawrence
* February 2021
* Head to chrome://dino and paste this code in the console to add a couple cheats!
* - press 's' to toggle "safe mode" where you can't lose
* - press 'p' to add 100 points to your score
*/
// toggles a mode where the player is not able to lose from collisions
Runner.prototype.toggleSafeMode = () => {
// How to get Math Autocorrect on Google Docs
// Type shortcuts inspired by LaTeX anywhere in Google Docs
// Script by Jonah Lawrence (c) 2021
//
// Steps:
// 1. Open a Google Doc
// 2. Click the Tools tab, then Preferences
// 3. Switch to the Substitutions Tab
// 4. Paste this script in the Console
@DenverCoder1
DenverCoder1 / github.inc
Created February 6, 2022 02:15
Webhook endpoint to pull code from GitHub when the repo is updated
<?php
define('GH_USERNAME', ''); // Username for authentication
define('GH_PASSWORD', ''); // GitHub Personal Access Token with repo scope* (starting with 'ghp_')
define('GH_REPO', ''); // GitHub Repo URL (eg. 'github.com/UserName/RepoName.git')
define('GH_SECRET', ''); // Webhook secret provided to GitHub when creating the webhook
// Steps:
// 1. Visit the repository on GitHub, select 'Settings', then 'Webhooks'
@DenverCoder1
DenverCoder1 / pypi-stats.md
Last active September 5, 2023 04:06
Pypi Download Statistics for Discord.py Forks and Related Projects
@DenverCoder1
DenverCoder1 / update-wordle-stats.js
Created April 28, 2022 20:39
Script to manually update Wordle stats
/**
* Script to manually update Wordle stats
*
* This can be useful for overriding stats if you want to transfer stats from
* another device, or you simply want to set your stats manually.
*
* @author Jonah Lawrence
* @version 1.0
* @license MIT
*
@DenverCoder1
DenverCoder1 / codenames.gs
Created July 22, 2022 22:36
Codenames Key Board Generator
/**
* Codenames.gs - JavaScript Codenames Key Board Generator
*
* This script was created for use in a Google Spreadsheet. See this link below
* for a printable version of the game and spreadsheets that generate the key boards.
*
* https://drive.google.com/drive/folders/1KHwA2W96sawlWOQq8Hl3FiUygB6PxG8o
*
* (c) 2020-2022, Jonah Lawrence
*