Skip to content

Instantly share code, notes, and snippets.

View mikesprague's full-sized avatar

Michael Sprague mikesprague

View GitHub Profile
/* source: https://andy-bell.co.uk/a-more-modern-css-reset/ */
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Prevent font size inflation */
@mikesprague
mikesprague / weatherkit-condition-codes.ts
Last active August 24, 2023 11:52
WeatherKit condition codes
// WeatherKit REST API documentation lists `conditionCode` as a property returned for
// various DataSets and says it's an enumeration value
// (e.g. https://developer.apple.com/documentation/weatherkitrestapi/currentweather/currentweatherdata)
// but never says what the possible return values could be anywhere in the REST API docs
//
// The following was created from info in the Swift documentation: https://developer.apple.com/documentation/weatherkit/weathercondition
export interface ConditionCode {
code: string;
description: string;
@mikesprague
mikesprague / run-updates.sh
Created May 25, 2023 16:28
Bash script to run some common updates/commands I use
#!/bin/bash
# PREREQUISITES:
# - Homebrew
# - Zsh
# - oh-my-zsh
# - Node.js with the following global packages installed:
# - npm-check-updates
# - n
# - Docker
@mikesprague
mikesprague / chatgpt-text-to-emojis.js
Last active April 24, 2023 14:49
Using OpenAI to analyze text and return relevant emojis
import { Configuration, OpenAIApi } from 'openai';
import dotenv from 'dotenv';
import { gptGetEmoji } from './helpers.js';
dotenv.config();
const { OPEN_AI_API_KEY } = process.env;
const configuration = new Configuration({
@mikesprague
mikesprague / conventional-commits.md
Created November 27, 2022 12:42 — forked from Zekfad/conventional-commits.md
Conventional Commits Cheatsheet

Quick examples

  • feat: new feature
  • fix(scope): bug in scope
  • feat!: breaking change / feat(scope)!: rework API
  • chore(deps): update dependencies

Commit types

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Changes which doesn't change source code or tests e.g. changes to the build process, auxiliary tools, libraries
@mikesprague
mikesprague / gist:5881937
Last active November 25, 2022 18:24
AWS: Bucket Policy Example (Allow Get by Referer)
{
"Version": "2008-10-17",
"Id": "http referer policy example",
"Statement": [
{
"Sid": "Allow get requests from certain domains (including local development)",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket-name-here/*",
@mikesprague
mikesprague / fcc-project-list.md
Last active November 25, 2022 14:55
Free Code Camp Project List

My Free Code Camp Projects

Collection of projects I'm doing while working through the Free Code Camp full stack web developer certifications.

Front End Development Certification

Basic Front End Development Projects

  • Build a Tribute Page | Requirements | Demo | Source Code
  • Build a Personal Portfolio Page | Requirements | Demo | Source Code
@mikesprague
mikesprague / get-current-wordle.js
Last active October 14, 2022 14:49
Use Playwright to get the current Wordle solution
import puppeteer from 'puppeteer'
const wordleUrl = 'https://www.nytimes.com/games/wordle/index.html';
const wordleLocalStorageKey = 'nyt-wordle-state';
const defaultTimezone = 'America/New_York';
(async () => {
const browser = await puppeteer.launch({
args: [
'--no-sandbox',
@mikesprague
mikesprague / scratch.js
Created April 20, 2022 19:31
Scratch file I use when experimenting with Node.js code
const { hrtime } = process;
(async () => {
const debugStartTime = hrtime();
// do stuff
const debugEndTime = hrtime(debugStartTime);
console.log(
`Execution time: ${debugEndTime[0] * 1000 + debugEndTime[1] / 1000000}ms`,
@mikesprague
mikesprague / udemy-dark-theme.css
Last active January 20, 2021 21:03
Dark User Style for Udemy (WIP)
body {
background-color: #101010 !important;
color: #fff !important;
}
.my-courses .my-courses-header {
background-color: #333 !important;
color: #ccc;
}
.curriculum-navigation {
background-color: #333 !important;