Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Sprague mikesprague

View GitHub Profile
@mikesprague
mikesprague / weatherkit-condition-codes.ts
Last active Jan 4, 2023
WeatherKit condition codes
View weatherkit-condition-codes.ts
// 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 / conventional-commits.md
Created Nov 27, 2022 — forked from Zekfad/conventional-commits.md
Conventional Commits Cheatsheet
View conventional-commits.md

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 / scratch.js
Created Apr 20, 2022
Scratch file I use when experimenting with Node.js code
View scratch.js
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 / get-current-wordle.js
Last active Oct 14, 2022
Use Playwright to get the current Wordle solution
View get-current-wordle.js
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',
View slack-4.css
*, html, html *, body, body * {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
text-rendering: geometricPrecision !important;
}
body {
word-spacing: -1px;
-webkit-font-smoothing: auto;
}
@mikesprague
mikesprague / index.html
Created Sep 16, 2018
JS to lighten, darken, or blend colors (credit to/original author: https://glitch.com/@notwaldorf)
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Color gradient</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono:400,700" rel="stylesheet">
<link rel="stylesheet" href="/style.css">
<script src="/script.js" defer></script>
@mikesprague
mikesprague / rollbar_deploy_notification.sh
Created Sep 3, 2018
Rollbar deploy notification (replace access token and rollbar user with your own values)
View rollbar_deploy_notification.sh
#!/bin/bash
ACCESS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ENVIRONMENT=production
REVISION=`git log -n 1 --pretty=format:"%H"`
COMMENT=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g'`
ROLLBAR_USER=xxxxxxxxxx
curl https://api.rollbar.com/api/1/deploy/ \
-F access_token=$ACCESS_TOKEN \
@mikesprague
mikesprague / localweather.io-20180819T153541.json
Created Aug 19, 2018
localweather.io - Google Lighthouse Audits - August 19, 2018 15:35
View localweather.io-20180819T153541.json
{
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.42 Safari/537.36",
"lighthouseVersion": "3.0.3",
"fetchTime": "2018-08-19T19:35:41.503Z",
"requestedUrl": "https://localweather.io/",
"finalUrl": "https://localweather.io/",
"runWarnings": [],
"audits": {
"is-on-https": {
"id": "is-on-https",
@mikesprague
mikesprague / install-docker-on-raspberry-pi.sh
Created Mar 18, 2018
Install and configure Docker for the Raspberry Pi
View install-docker-on-raspberry-pi.sh
# get/start the offical docker installer
curl -sSL https://get.docker.com | sh
# set docker to auto-start
sudo systemctl enable docker
# start the docker daemon
sudo systemctl start docker
# enable docker client
@mikesprague
mikesprague / slack-dark.css
Created Feb 19, 2018
My dark Slack theme
View slack-dark.css
html {
background: #404552 !important;
}
body {
background: #404552;
color: #d3dae3;
}
a {