Skip to content

Instantly share code, notes, and snippets.

View robatron's full-sized avatar
🤖

Rob McGuire robatron

🤖
  • Zillow
  • Seattle, WA
View GitHub Profile
@robatron
robatron / javascript-log-wrapping.md
Last active February 6, 2024 06:49
Wrapping `console.log` (et al.) in your own function to modify logging behavior.

JavaScript Log Wrapping

Wrapping console.log (et al.) in your own function to modify logging behavior.

Why?

You may want a simple way to:

If you want to achieve greatness stop asking for permission. ~Anonymous
Things work out best for those who make the best of how things work out. ~John Wooden
To live a creative life, we must lose our fear of being wrong. ~Anonymous
If you are not willing to risk the usual you will have to settle for the ordinary. ~Jim Rohn
Trust because you are willing to accept the risk, not because it's safe or certain. ~Anonymous
Take up one idea. Make that one idea your life - think of it, dream of it, live on that idea. Let the brain, muscles, nerves, every part of your body, be full of that idea, and just leave every other idea alone. This is the way to success. ~Swami Vivekananda
All our dreams can come true if we have the courage to pursue them. ~Walt Disney
Good things come to people who wait, but better things come to those who go out and get them. ~Anonymous
If you do what you always did, you will get what you always got. ~Anonymous
Success is walking from failure to failure with no loss of enthusiasm. ~Winston Chu
@robatron
robatron / making-a-timelapse.md
Last active December 17, 2023 10:40
Making a Timelapse Video with a GoPro and a MacBook

Making a Timelapse Video with a GoPro and a MacBook

Here are some details about how I made this timelapse video with a GoPro and a Mac. It wasn't as straight-forward as I thought it would be, so I wanted to share what I learned.

As you can see from the video, the subject was me building a wooden mechanical 3D puzzle which took me nearly 18 hours to build. I took a photo once every 5 seconds which yeilded more than 12.7k photos.

Ingredients

Here's what I used to make a timelapse video.

@robatron
robatron / strava-quick-manual-entry.user.js
Last active September 13, 2023 17:22
Strava Quick Manual Entry (Tampermonkey)
// ==UserScript==
// @name Strava Quick Manual Entry
// @version 0.1.1
// @description Adds an input box to the manual entry page allowing for quick entry of an activity
// @author robert.mcgui@gmail.com
// @match https://www.strava.com/upload/manual
// @icon https://d3nn82uaxijpm6.cloudfront.net/favicon-32x32.png
// @grant none
// @sandbox JavaScript
// @downloadURL https://gist.githubusercontent.com/robatron/5590620a5346715062301ebc0af0ed65/raw/sqme.user.js
@robatron
robatron / slack-message-tweaks.user.js
Last active August 10, 2023 07:38
Slack Message Tweaks (Tampermonkey)
// ==UserScript==
// @name Slack Message Tweaks
// @version 0.0.2
// @description Add absolute timestamps to messages, and swap app links for web links
// @author robert.mcgui@gmail.com
// @match https://app.slack.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @sandbox JavaScript
// @downloadURL https://gist.githubusercontent.com/robatron/0e4fcda19f77b1b6471ea72cda96ca89/raw/slack-message-tweaks.user.js

Automatically Prepend a Jira Issue ID to Git Commit Messages

Use a git hook to match a Jira issue ID from the current branch, and prepend it to every commit message

Assuming the current branch contains a Jira issue ID, you can use a git hook script to prepend it to every commit message.

  1. Create an empty commit-msg git hook file, and make it executable. From your project's root directory:

     install -b -m 755 /dev/null .git/hooks/commit-msg
    
  2. Save the following script to the newly-created .git/hooks/commit-msg file:

@robatron
robatron / hot-spiked-mulled-apple-cider.md
Created October 21, 2020 18:33
Hot Spiked Mulled Apple Cider Slow Cooker Recipe

Ingredients

  • 1 gallon unfiltered apple juice or apple cider
  • 1 large orange, cut into slices
  • Small ginger root, peeled, cut into ~1" cubes
  • 3-4 cinnamon sticks
  • 4 star anise
  • 1 tablespoon whole cloves
  • 1 tablespoon whole allspice
  • (Optional) 21 oz (621 ml) bourbon or rum. Assuming 16 oz of juice is removed per directions below, this will yield about "1 shot" (1.5 oz) of alcohol per 8 oz of drink.
@robatron
robatron / fallout-1-high-res-patch-mac-osx.md
Last active October 8, 2019 08:59
How to get the Fallout 1 (and Fallout 2) high-resolution patch working for Mac OS X

Fallout 1 (and Fallout 2) Hi-Res Patch for Mac OS X

Fallout 1 was originally designed to run at 640x480 resolution. I wanted to run the Mac OS X version of Fallout on my MacBook 11", which has a 1366x768 display. There is a [high resolution patch][hi-res], but it only supports the Windows version of Fallout.

Turns out that the OS X version of Fallout runs through Wine, so we can get this patch working with just a few configuration changes:

Note for Fallout 2 users: The process for Fallout 2 is essentially the same, with a different patch, and some minor pathing differences. Other than that, the process is exactly the same!

Install Wine

@robatron
robatron / generalized-tree-search.md
Last active September 6, 2018 12:50
Generalized tree search (DFS, BFS)

Generalized Tree Search

A generalized depth and breadth-first tree search algorithm

Here's a neat little algorithm that can perform a depth-first search (DFS) or breadth-first search (BFS) by simply changing the collection data type:

search( Node root ) {
    Collection c = new Collection()
 c.push( root )
#!/bin/bash
# Remote script to install these dotfiles on a system
system_type=$(uname -s)
repo_url="https://robatron@bitbucket.org/robatron/dotfiles.git"
echo "Verifying git installed..."
if ! [ -x "$(command -v git)" ]; then