Skip to content

Instantly share code, notes, and snippets.

💚

Justin Searls searls

💚
Block or report user

Report or block searls

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
View halp.md

Given this program foo.rb:

require "optparse"

options = {delimiter: " "}
OptionParser.new { |op|
  op.on("-d", "--delimiter [DELIM]", "String separating columns")
View example.md

Here's a neat trick.

I treat my git clones as disposable between computers, but keep my project-specific dotfiles (usually containing environment variables, individual configurations, and so on) synced across devices in iCloud. Then, this script is just a matter of adding symlinks for each of the dotfiles I've saved for each of my projects to each of their clones.

So if my dotfiles are saved like this:

$ tree -a ~/icloud-drive/dotfiles/project-dotfiles/
/Users/justin/icloud-drive/dotfiles/project-dotfiles/
├── searls
@searls
searls / preview.sh
Created Jun 15, 2019
A script I wrote to preview a build directory (in my case Hugo's `public` folder, but adjust to taste).
View preview.sh
#!/bin/sh
port=${1-1919}
# 1. Navigate to the built folder & start a server in it
cd public
python -m SimpleHTTPServer "$port" &
server_pid=$!
# 2. Trap any killing of this process so that we kill the backgrounded server
View jim-memories.md

I was asked to share a few memories of Jim Weirich as someone prepared for a conference talk about him, so I figured I'd share what came to mind here:

  1. My cofounder Todd Kaufman would often refer to Jim as the "Santa Claus of the Ruby community". He was a big, jolly guy and he always brought joy to every room he was in. If people take away one thing to know about Jim, it's that even when he had 30 years of experience on someone, he always treated them with tremendous deference and respect. He always approached my ideas and questions as if they were urgent and fascinating, even if he'd encountered them dozens of times before. It's a trait I strive to imitate whenever I meet people at a user group or a conference, because it made such an impact on me when someone that I looked up to treated me like my experiences mattered to them.

  2. I would sometimes drive 2 hours from Columbus to Cincinnati just to hang out at Jim's office. No matter what client work he had to do, he was never too busy for me. I remember

View japan-interview.md

WaniKani sent me this interview since I'd reached the program's max level. I figured I'd save my answers here for posterity.

Q: Why did you study Japanese?

I took German language in high school, but both its similarities to English and the near English fluency in every German person I've ever met conspired to discourage me from really taking it seriously.

I did, however, learn that the act of studying another language was a deeply perspective-altering activity. When you see how a language and a culture are inextricably linked, it triggers in me an introspection of my own ideology—what do I take for granted that's encoded into the English words I say or how I use them?

Ultimately, this led me to want to learn the most challenging language I could find, with a secondary priority for cultures that my own experience would relate to the least. Of Japanese, Chinese, and Russian, the emphasis on subtlety and harmony in Japanese culture put it over the top. Once I started studying,

View pull-request-pr.md

This will get well-actually'd to death, but to keep it simple, here's what I have been doing for the last several years when I have an open PR and master gets ahead of me

Open the PR

  1. Start the branch with git checkout -b blah-blah
  2. commit stuff
  3. git push
  4. Rush to the web UI and click "open pull request" after I see the "new branch" detected and mark it as WIP or whatever if it's not ready to merge right away

Updating master

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
You can’t perform that action at this time.