Skip to content

Instantly share code, notes, and snippets.

Old Toots from thisemailfindsyou at botsin.space

Newer ones are at thisemailfindsyou@mastodon.social

  • I hope this email finds you extra-hungry, this salad is sure to fill you up.
  • I hope this email finds you happy and leaves you miserable, builds you up or plucks you down.
  • I hope this email finds you in a desert place, that's when His instruction is clear: “Put off thy shoes from off thy feet, for the place whereon thou standest is holy ground."
  • I hope this email finds you worthy to live this life.
  • I hope this email finds you and helps you fly away from your enemy.
  • I hope this email finds you well and happy-ish (Happy-ish, because we can't have too much well-being among my clients, now can we?)
@JohnB
JohnB / YAxis
Created July 20, 2022 20:51
Swift example code to improve the MapMyWalk altitude graph
// This code was created by https://codelanguageconverter.com/
// in an automatic conversion from https://gist.github.com/JohnB/055e126e4b581de802acb451691a1a4f
// (after stripping most comments to fit in the free conversion limit and then re-adding them).
//
// NOTE: the conversion seems to have been confused by the elixir "case" statement, and forgot to convert
// it to a "switch" with varioius cases and will likely need to be fixed (but I don't have a swift compiler handy).
//
class YAxis {
// The YAxis module attempts to find "reasonable" values for the MapMyWalk
// altitude graph. For example, my MapMyWalk graph (as of 7/2022) offers
@JohnB
JohnB / y_axis.ex
Last active July 20, 2022 20:20
Example code to improve the MapMyWalk altitude graph
defmodule YAxis do
@moduledoc """
The YAxis module attempts to find "reasonable" values for the MapMyWalk
altitude graph. For example, my MapMyWalk graph (as of 7/2022) offers
these altitude values when my workout goes from 138 to 198 feet:
20.4, 79.5, 138.5, 197.6, 256.6, 315.7
Which I find to be much less readable/understandable than:
120, 140, 160, 180, 200, 220

Keybase proof

I hereby claim:

  • I am johnb on github.
  • I am johnb (https://keybase.io/johnb) on keybase.
  • I have a public key ASB5S-uxyB8B6V4NPLsrhSuT5YiyajgCUXwWVDoQ_eHGPAo

To claim this, I am signing this object:

@JohnB
JohnB / gist:42706e097544f2a7f1f31209dcdef40d
Created August 17, 2020 18:20
Phoenix dir, built by John Baylor, for a user queue JSON API for Tubi.
gist --login
@JohnB
JohnB / stack.ex
Last active October 22, 2017 20:32
Object-oriented version of the canonical stack example.
defmodule Stack do
use GenServer
# Public Interface (runs in the caller's process)
def create() do
{:ok, pid} = GenServer.start_link(__MODULE__, [])
pid
end
@JohnB
JohnB / list_comprehension.rb
Created November 20, 2014 19:54
List comprehension in ruby
# Inspired by https://blog.engineyard.com/2014/ruby-list-comprehension
module Kernel
def c(comprehension, &block)
scope = block.send(:binding)
if comprehension =~ /^\s*(\S.*)\s+for\s+(\S+)\s+in\s+(.*)$/
amount, for_variable, in_range = $1,$2,$3
scope.send(:eval, in_range).map do |value|
scope.send(:eval, "#{for_variable} = #{value}")
scope.send(:eval, "#{for_variable} = #{amount}")
@JohnB
JohnB / loginButtons
Created April 1, 2014 22:03
How meteor's {{loginButtons}} worked until October 2013
// NOTE: this code was replaced here:
// https://github.com/meteor/meteor/commit/119682c8ec26e84e63e3e62bf0510d515aa78d97#diff-e7d59a612c271f7d2ee876d7802cf170L4
Handlebars.registerHelper( // 4
"loginButtons", // 5
function (options) { // 6
if (options.hash.align === "right") // 7
return new Handlebars.SafeString(Template._loginButtons({align: "right"})); // 8
else // 9
return new Handlebars.SafeString(Template._loginButtons({align: "left"})); // 10
@JohnB
JohnB / collaborators.rb
Last active December 26, 2015 00:48
List your repositories and their collaborators
require 'json'
#
# List your repositories and their collaborators
#
# Before running this script, follow these steps:
# 1) get an OAuth token from https://github.com/settings/applications
# 2) add it to your environment with "export GW=abc123..."
# 3) add your github user to your environment (e.g. "export GWUSER=JohnB" is mine)
# 4) run this script via "ruby collabotators.rb"
#
@JohnB
JohnB / vj.sh
Last active May 25, 2020 19:29 — forked from kljensen/vj.sh
Added location, updated link to the access-os-x-keychain-from-terminal blog post and added some explanatory text.
#!/usr/bin/env bash
# Canonical location: https://gist.github.com/kljensen/4434992
##########################################################
#
# This is a shell script for keeping a journal that is
# * plaintext,
# * time-stamped,
# * encrypted, and