Skip to content

Instantly share code, notes, and snippets.

😁
on-call today

Jonathan Hoyt jonmagic

😁
on-call today
Block or report user

Report or block jonmagic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jonmagic
jonmagic / red_green.ino
Last active Jul 21, 2019
Program for red and green light interactive alarm clock.
View red_green.ino
#include <math.h>
int BUTTON = D0;
int GREEN_LED = D1;
int RED_LED = A4;
int buttonState = 0;
// Takes the current hour (0-23) and multiplies it by 60 (minutes) and then
// adds the minutes after the hour (0-59.
View useful_pandas_snippets.py
# List unique values in a DataFrame column
# h/t @makmanalp for the updated syntax!
df['Column Name'].unique()
# Convert Series datatype to numeric (will error if column has non-numeric values)
# h/t @makmanalp
pd.to_numeric(df['Column Name'])
# Convert Series datatype to numeric, changing non-numeric values to NaN
# h/t @makmanalp for the updated syntax!
@jonmagic
jonmagic / Adafruit_GPS.cpp
Created Apr 21, 2018 — forked from dmiddlecamp/Adafruit_GPS.cpp
Spark GPS demo with Adafruit Ultimate GPS breakout
View Adafruit_GPS.cpp
/***********************************
This is our GPS library
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, check license.txt for more information
All text above must be included in any redistribution
@jonmagic
jonmagic / install-kafka.txt
Created Dec 11, 2017 — forked from jarrad/install-kafka.txt
Install Kafka on OSX via Homebrew
View install-kafka.txt
$> brew cask install java
$> brew install kafka
$> vim ~/bin/kafka
# ~/bin/kafka
#!/bin/bash
zkServer start
kafka-server-start.sh /usr/local/etc/kafka/server.properties
View arca-blog-post.md
layout title
post
Arca

Arca is a callback analyzer for ActiveRecord models ideally suited for digging yourself out of callback hell.

Arca was created in July of last year while I was working on tools for migrating customer data from github.com to GitHub Enterprise and for consolidating GitHub Enterprise instances. The tools we built had just shipped and as customers began using the tool we started getting reports that some imports were failing.

Our investigation into these bugs eventually led us to ActiveRecord callbacks. We found two patterns that I’d like to talk about.

@jonmagic
jonmagic / seconds.csv
Last active Dec 8, 2015
This is binary data captured from a car stereo and it's companion cd changer. The stereo updates it's screen with the cd track minutes and "seconds". Each row below corresponds to the "seconds". Column 1 is the seconds, 2 is binary, 3 is 2 inverted. The goal is figuring out how to generate the seconds from 0's & 1's without the table below.
View seconds.csv
seconds message inverted-message
4 110 001
5 00101 11010
6 10100 01011
7 01100 10011
8 11101 00010
9 00011 11100
10 10010 01101
11 0000101 1111010
12 1000100 0111011
View .bash_profile
alias st='osascript /path/to/theme-switcher.scpt'
View addon.rb
module Addon
def self.included(base)
base.class_eval do
before_save :update_addon
end
end
def update_addon
puts "updating addon"
end
You can’t perform that action at this time.