As you do.
(via fuckyeahprettyplaces)
Preparing Data for Use in URLs
I like to ensure that any data I have that goes into a URL, like a “slug” for the title of a post, or a real-world option like a brand of car, are considered and prepared for inclusion in a URL before I smash them in there.
For instance, if I had a site that had a database of different vehicles, separated by brand, one might expect a URL like:
example.com/cars/{brand}
In this case, brand will correspond to makes like “Mazda”, “Toyota”, “Aston Martin, etc. The naïve approach would be to just smash those values into the URL:
example.com/cars/Mazda
example.com/cars/Toyota
example.com/cars/Aston%20Martin
But the inconsistency in capitalization and the ugly URL-encoded space character stand out like sore thumbs. Instead, I would prepare these values for inclusion in the URL by making them lower case and replacing non-word characters with hyphens:
example.com/cars/mazda
example.com/cars/toyota
example.com/cars/aston-martin
It seems like a simple thing, but many developers just won’t think of taking a step like this, or won’t bother investing the effort. That leads to a worse experience overall, in my opinion.
Remember: URLs should be designed too, along with everything else on a web site or app, for both form and function.
httpie
Human-friendly curl replacement. Lovely.
Raise the Crime Rate
There is a huge problem with prisons and the way ex-convicts are treated in this country—that would be dishonest to dispute, or at least brazenly classist. That’s pretty much the extent of what I was convinced of by this article, though.
How about looking at how other countries handle similar problems, especially ones that face less individual risk and have drastically different crime prevention and punishment strategies? The final charge is laughably unpersuasive, especially for someone who believes in a lot of laissez-faire economics: “In high finance, the laissez-faire approach has proved to be a disaster; for petty crime, it would be a boon.” Oh really?
Better yet, why not de-federalize the issue by decriminalizing most or all of the federal criminal offenses, leaving states to handle them individually? Then at least we might get some experimentation with different models among the states—something that was a feature, not a bug, in the original national design.
I found his recommendations wholly unconvincing, almost to the point of absurdity, and especially in the face of the evidence of tangible recidivism, some of which he cited.
Using Bundler binstubs with RVM
There’s a feature of Bundler called binstubs which will installed bundler-wrapper executables for your gem executables in a directory of your choosing (./bin by default). This makes it so you don’t have to type bundle exec before every bundler-installed gem executable.
The trick, though is getting ./bin added to your PATH only when it’s appropriate, i.e. when you cd into a project that has Bundler binstubs installed to ./bin.
Thankfully, RVM has a built-in hook to add ./bin to your path—well, sorta.
I followed the instructions on that RVM page and found that I had issues with it as an after_cd hook because I use bash aliases that are apparently defined before RVM is fully loaded into my shell. I also think that an after_cd hook is overkill in this case, as you only need ./bin to be added when you enter a project’s root dir, which is precisely where (in my case at least) you have an .rvmrc that is calling rvm use …. This makes it a perfect candidate for an after_use hook:
$ cp $rvm_path/hooks/after_{cd,use}_bundler
$ chmod +x $rvm_path/hooks/after_use*
$ ll $rvm_path/hooks/
total 48
-rw-r--r-- 1 bfults staff 274 Feb 27 14:43 after_cd
-rw-r--r-- 1 bfults staff 1652 Feb 27 15:02 after_cd_bundler
-rwxr-xr-x 1 bfults staff 280 Feb 27 14:43 after_use
-rwxr-xr-x 1 bfults staff 1639 Feb 27 15:10 after_use_bundler
-rw-r--r-- 1 bfults staff 289 Feb 27 14:43 after_use_jruby
-rw-r--r-- 1 bfults staff 252 Feb 27 14:43 after_use_jruby_opts
I also changed the script a bit to add some helpful output when it modifies the PATH so I remember that it’s using binstubbed executables. See my modified after_use_bundler.
Lastly, for that hook to work, you need to tell Bundler to explicitly add ./bin to its config:
$ bundle config bin "./bin"
$ cat .bundle/config
---
BUNDLE_BIN: ./bin
The Worst Part of Tech Meetups
Of the many tech meetups I’ve been to over the last 10 years in San Diego, San Francisco and Austin, there is one persistent commonality that always tries to ruin my experience. I’m talking about the shameless conversation derailer.
These people are usually few in number, but they make up for that by monopolizing Q&A time or simply interrupting others at the meetup with their ill-considered and long-winded rants about tangentially related subjects. Everyone else, of course, wants to be polite and avoid an aggressive confrontation, but this simply paves the way for the derailer to continue their campaign of destruction until every person at the meetup simply wants to leave.
The damage from this type of interaction goes far beyond the time they waste in the moment, because other attendees will base their future decisions to attend partly on past bad experiences, and often decide to skip such annoying episodes. I, for one, have stopped attending certain meetups altogether when faced with a recurring derailer problem.
I’m not sure of the best way to go about solving an issue like this, especially in the moment. I know that some derailers are simply unaware or unequipped to self-moderate, so that must be taken into account when we respond. A polite request to move longer discussions to a later time, or a suggestion to turn meandering thoughts into a blog post, perhaps. But we must respond and defuse these situations in order to allow the best parts of tech meetups shine through, which provide innumerable benefits to all.
Technological Progress in Society
There’s an aspect of tech enthusiasm that leads to popular lament of wasted or misdirected skills. But I think the only real way to have an impact on overall industry trends, and thus the focus of collective productive energy, is to start businesses or movements and create cultures within the industry that provide new rallying points, examples and inspiration for other thinkers to riff off. It’s like one big organism where each tiny bit has its own agency, but as a whole the average tends to move toward the most compelling ideas of the time.
On Modern Relationships
During an email conversation with a friend, he remarks and I respond:
I’ve found it notable that friends who might entertain the idea of cheating find the notion of an explicitly open relationship difficult to weather.
I definitely find the same to be true. I think it can be explained with a basic theory of maturity or development in relationships: the naïve or undeveloped are jealously guarded about the status quo in their relationship, whatever it may be. This may just be a manifestation of loss anxiety applied to a high-value personal asset (the relationship or partner), where the person feels judged for their own ability to keep their mate. In this view, marriage is a sort of release valve, where they can end most of their anxiety by pledging monogamy (and receiving loyalty) forever. But the very naïvete or lack of development that led to their anxiety often leads to the destruction of their relationship (sometimes via cheating) because they never learn to grow the relationship with their partner.
This type of reflection often strikes me as tragic with my knowledge of US history, especially considering things like post-WWII soldiers coming back to claim their wives and start their families. They had no reason to believe that locking a wife down and not worrying about it anymore wasn’t the right course of action. As women’s liberation continued in the ensuing decades, American men had the same or similar expectations to their fathers, but the set of possible relationship dynamics was expanding beneath their feet and they were socially ill-equipped for the change. Hence the sharply increased divorce rates and romanticizing about the good old days, back when a man could rely on his wife-for-life to raise his kids and be quiet about it.
The standard narrative is that there’s something wrong with modern
URL turds are the annoying hash (#) marks that get left on the end of a URL when a front-end developer didn’t do their job by suppressing the default event on JavaScript clicks.
When you are tempted to use <a href="#" …>, don’t. Add a click handler to an element that’s not a link—you’re not linking to anything!
URL turds are a pox upon humanity and must not be tolerated.
