Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Jensen elnjensen

  • Swarthmore, Pennsylvania, USA
View GitHub Profile
@elnjensen
elnjensen / Calculate Moon synchronous period.ipynb
Created Jul 18, 2020
Calculate the period for tidal locking of the Earth and Moon
View Calculate Moon synchronous period.ipynb
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 Feb 16, 2020
Simple notebook to print Loop app settings in text form from an issue report
View Print Loop Settings.ipynb
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 Feb 4, 2020
Example of using astroquery to get a distance from Simbad for a given object, and getting coordinates from astropy.
View Astroquery Simbad distance example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elnjensen
elnjensen / Query_Gaia_DR2.ipynb
Created Nov 3, 2018
Example of querying Gaia DR2 from Python
View Query_Gaia_DR2.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View CalculateColorContrast.swift
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 / WatchWorkoutMenu.swift
Created Aug 22, 2018
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
View WatchWorkoutMenu.swift
// 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) {
@elnjensen
elnjensen / Insulin activity.ipynb
Created Aug 20, 2016
Plot of insulin on board
View Insulin activity.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.