Skip to content

Instantly share code, notes, and snippets.

View elnjensen's full-sized avatar

Eric Jensen elnjensen

  • Swarthmore, Pennsylvania, USA
View GitHub Profile
@elnjensen
elnjensen / Insulin activity.ipynb
Created August 20, 2016 03:28
Plot of insulin on board
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elnjensen
elnjensen / WatchWorkoutMenu.swift
Created August 22, 2018 02:42
Swift code to add to ActionHUDController.swift in Loop to add a force-touch menu to the Watch to set workout mode for different durations
// Add this code inside the class definition for ActionHUDController.swift in WatchApp Extension --> Controllers
// Add force-touch menu items to set workout mode for certain fixed durations:
override init() {
super.init()
addMenuItem(withImageNamed: "workout", title: NSLocalizedString("Workout 30 minutes", comment: "Menu title for setting workout duration from watch"), action: #selector(ActionHUDController.setWorkout30Min))
addMenuItem(withImageNamed: "workout", title: NSLocalizedString("Workout 1 hour", comment: "Menu title for setting workout duration from watch"), action: #selector(ActionHUDController.setWorkout1Hour))
addMenuItem(withImageNamed: "workout", title: NSLocalizedString("Workout 2 hours", comment: "Menu title for setting workout duration from watch"), action: #selector(ActionHUDController.setWorkout2Hours))
}
private func setWorkoutMode(duration: Double) {
import UIKit
// Extension from lkoskela, https://gist.github.com/lkoskela/c06670ded4d01a1832bd90066e76a0a8
extension UIColor {
/// Relative luminance of a color according to W3's WCAG 2.0:
/// https://www.w3.org/TR/WCAG20/#relativeluminancedef
var luminance: CGFloat {
var red: CGFloat = 0
var green: CGFloat = 0
@elnjensen
elnjensen / Query_Gaia_DR2.ipynb
Created November 3, 2018 20:34
Example of querying Gaia DR2 from Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elnjensen
elnjensen / Astroquery Simbad distance example.ipynb
Created February 4, 2020 01:16
Example of using astroquery to get a distance from Simbad for a given object, and getting coordinates from astropy.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elnjensen
elnjensen / Print Loop Settings.ipynb
Created February 16, 2020 02:20
Simple notebook to print Loop app settings in text form from an issue report
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elnjensen
elnjensen / Calculate Moon synchronous period.ipynb
Created July 18, 2020 01:20
Calculate the period for tidal locking of the Earth and Moon
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.