Instantly share code, notes, and snippets.

Justin Searls searls

View GitHub Profile
View ios-keyboard-focus-scroll-hack.md

The problem

When a MobileSafari keyboard-receing input (e.g. an input[type=text]) receives focus in Safari, the system will try to verify whether there is ample room to bring up the soft keyboard without needing to scroll. The amount of wiggle room needed for Safari to consider available scroll height "ample" seems to increase with every major iOS release (surely to work around the very real problem of focus being granted to inputs that are subsequently oscured by the keyboard).

However, for "app-ey" web sites that carefully place each text input in a relatively fixed layout, this can be a maddening arms of scooching up my content more and more with each iOS release to avoid awkward jutters every time the keyboard is shown (example video here. In practice, it seems like the input's scrollHeight can only really be about the equivalent of 15vh before you're likely to get an automated scrolling whiplash from the soft keyboard, which isn't much

@searls
searls / bugsnag-2.md
Last active Jan 5, 2019
Downgrading the JS Bugsnag client from 3.x to 2.x
View bugsnag-2.md

Downgrading the JS Bugsnag client from 3.x to 2.x

Why?

It's smaller (as of 2019-01-05). The size of my application was reduced from 223KB to 194KB. After talking to Gary, he mentioned that James Smith had pointed him to the smaller legacy client, so I tried it out.

How?

To keep using Bugsnag@2, grab this:

@searls
searls / 2019-winter-ruby-abstract.md
Last active Dec 27, 2018
Winter 2019 Ruby talk proposal
View 2019-winter-ruby-abstract.md

The Selfish Programmer

Using Ruby at work is great… but sometimes it feels like a job!

This year, I rediscovered the joy of writing Ruby apps for nobody but myself—and you should, too! Solo development is a great way to learn skills, to find inspiration, and to distill what matters most about programming.

Building an entire app by yourself can be overwhelming, but this talk will make it easier. We'll start with a minimal toolset that one person can maintain. You'll learn how many "bad" coding practices can actually reduce complexity. You may be surprised how selfish coding can make you a better team member, too!

Details

View share-link-from-google.md
@searls
searls / memo_me.rb
Created Oct 18, 2018
A class-wrapping memoization dingus
View memo_me.rb
def MemoMe(superclass)
# Ripped mostly out of
# https://github.com/ruby/ruby/blob/trunk/lib/delegate.rb
klass = Class.new(superclass)
methods = superclass.instance_methods
methods -= [:to_s, :inspect, :=~, :!~, :===, :instance_variable_get, :instance_variable_set]
klass.define_method(:initialize, lambda do |*args|
@__memo_me_instance = superclass.new(*args)
end)
klass.module_eval do
@searls
searls / basketball.md
Created Oct 12, 2018 — forked from stevenjackson/basketball.txt
How I Learned to be a Better Technologist (by Coaching Youth Basketball)
View basketball.md
- Giving it to the best player doesn't make the team better
- Positive reinforcement
- You can't play for them
- You're going to be ignored / Shared understanding takes forever
- The game is not the most important thing

I coached a rec team that had a huge range of talent. One young man was very talented and could have gone on to play junior college basketball. I had a couple that were a level below him and then varying levels all the way down to the kid who was surprised when the basketball was in his hands. I did focus on leveling up everyone in practice, but our in-game style quickly devolved to give it to the best kid and move around him. This was moderately successful, everyone got to contribute, and the games were competitive. Then that kid got sick. Then baseball season started and he wanted to focus on that. All of a sudden my team had no identity and no idea how to win. We couldn't just lean on the next best player, the talent gap was too wide. Before the team could r

@searls
searls / bing-wanikani-results-count.json
Created Sep 16, 2018
Naive search results count for every kanji & vocab character string in WaniKani against the Bing Web Search API v7
View bing-wanikani-results-count.json
{
"関する": 129000000,
"公告": 96800000,
"愛知県": 68200000,
"埼玉県": 67700000,
"神奈川県": 67700000,
"一人": 60400000,
"年中": 60300000,
"一等": 59800000,
"的": 59100000,
@searls
searls / 1-search.js
Last active Sep 15, 2018
I refactored the example quickstart code provided on Azure's cognitive API
View 1-search.js
// Original doc on https://docs.microsoft.com/en-us/azure/cognitive-services/bing-web-search/quickstarts/nodejs#make-a-request-and-print-the-response
// This will not run because the doc's ordering led me to call an undefined method
// Use strict mode.
'use strict';
// Require the https module.
let https = require('https');
// Replace with a valid subscription key.
View calvin-talk-reflections.md

Dear everyone-who-attended-my-talk earlier this week,

First, thank you for coming! It was such a joy to see a large and engaged group interested in hearing a bit of my reflections in my first decade since graduating from Calvin. I'm confident that all of your experiences will emerge in their own right and lead you to profound insights that you can pass on to the folks who come up behind you.

I wanted to send this note to share a handful of resources with you of things that I referenced in the talk (I realize I talk too quickly to take decent notes). Here they are in no particular order:

View add_webcal.md

Add a WebCal (iCalendar) feed URL

Google Calendar

In the Google Cal UI, click the + button above your calendar list and choose "From URL":

screen shot 2018-09-12 at 8 49 28 am

Enter the WebCal URL: