How are you going to take one of the best book covers of the last couple years and turn it into the most banal film poster?
Recently I was creating a Git alias for logs that used
--date=human for date formatting, before realizing this option had only been added in Git 2.21. After pulling the alias to some of my other machines and seeing that it failed, I decided I wanted a conditional line in my Git config that tested my current version of Git, used
--date=human if possible, and
--date=short if not.
Git’s config syntax doesn’t allow for conditionals, but it does allow for the running of arbitrary bits of shell script. For instance, something like this will work:
[alias] lg = "!if (( "1 > 2" )); then git log --oneline; else git log; fi"
Because 1 is not greater than 2,
git lg will perform a standard
How do we compare our version of Git to a specific value, then? Let’s figure out how to get just our version number of Git first:
$ git --version | sed -E 's/git version ([0-9]+.[0-9]+).*/\1/g'
For me this returns
2.29. We need to check that this is greater than
2.20. Let’s try this:
$ if (( "2.29 > 2.20" )); then echo "Compatible"; else echo "Not compatible"; fi
Why doesn’t this work? I’m getting an
invalid arithmetic operator error.
Turns out Bash only handles integer math, so we need to pipe our comparison expression to a basic calculator program:
$ if (( $(echo "2.29 > 2.20" | bc) )); then echo "Compatible"; else echo "Not compatible"; fi
Great! Works for me. Now we just need to get our actual Git version in there instead of the literal
After some struggle — the
\1 reference in
sed needs to be double-escaped here, for some reason — this is the result:
[alias] lg = "!if (( \ $(echo \"$(git --version | sed -E 's/git version ([0-9]+.[0-9]+).*/\\1/') > 2.20\" | bc) \ )); then \ DATE="--date=human"; \ else \ DATE="--date=short"; \ fi; \ git log --pretty=format:\"%h %ad %s\" $DATE"
git lg will show a single-line log with “human”-formatted date if possible, or a “short”-formatted date if not.
I’ve created a Gist that puts this all together.
I’m envious of the technology in Facebook’s Portal; I walked past a demo unit at a Best Buy last year and was so delighted to see the camera follow me wherever I walked. It may have zoomed as well? I don’t remember, but it’s a far cry from the experience on the Amazon Echo Show I was gifted earlier this year, which is angled upward by default and therefore perpetually propped up on a coaster and whose use usually involves crouching and contorting my whole body uncomfortably for 15 minutes while video chatting.
I don’t want to invite Facebook into my life any more than it already is, or require my friends and family to invite it into theirs (for hundreds of dollars) so we can video chat more comfortably. On the other hand, most people I know already own some Apple product that is capable of FaceTime, making it our go-to video chat software during the pandemic.
I’m lucky enough to have a gooseneck phone mount, which, when clipped to the coffee table, makes these FaceTime sessions at least somewhat more comfortable, but the size of the screen and speakers leaves a lot to be desired.Continue reading “How we could get FaceTime on our TVs”
A few jobs ago, I was helping someone with a small tech issue, standing over their shoulder at their computer. The screen was unbelievably dark; I’m not exaggerating when I say it looked to be near 0% brightness.
For all I knew, this person had some vision sensitivity or just a basic personal preference that caused them to set it like this, but just in case, I cautiously asked, “By the way, I noticed your screen seems dark; do you prefer it like that, or would you like it to be brighter?”
“I guess it is kind of dark,” they said. I tried some of the buttons on the side of the monitor and found that it had been set to like 5 or 10% brightness. I turned it up to 50% or whatever and they were shocked at how much more easily they were able to see things on it.
It had just never occurred to them that it could be better.Continue reading “People expect technology to suck”
Here’s a small thing that nobody cares about but me, because nobody “games” on the Apple TV:
tvOS 14 promised Game Center switching for when you have multiple Apple TV users, so different users’ progress can be saved and loaded separately. What I didn’t know until running the beta is that games have to opt in to this, so games don’t have it by default.
I would expect that Apple Arcade games would all support this flagship feature of tvOS 14 (insofar as tvOS can have “flagship features”), but none of them that I have seems to support it yet. Are they all just going to drop updates today to support Game Center switching?
If so, that’s kind of crazy and weird last-minute timing. If not, that means Apple’s subscription gaming service won’t support one of the most important gaming features on Apple TV.
Internationalization (i18n) and localization (l10n) are important and often overlooked aspects of WordPress development. Themes should give developers and administrators the ability to add translations for users from among the roughly 95% of the world whose first language isn’t English.
There are plenty of articles written about how to provide i18n and l10n for a single theme, but what about child themes? When building a child theme, assuming the parent theme is properly internationalized, developers may want to do any or all of the following:
- Provide localizations that aren’t provided by the parent theme, either in different languages or in gaps in existing localizations.
- Modify existing localizations in the parent theme, for instance if the developer of the child theme wants to change the wording of some area of the site.
- Provide new internationalizations unique to the child theme, using the child theme’s text domain.
Let’s start by looking at a simple example of i18n in a WordPress theme. For the purposes of this article, the parent theme will be called “Parent Theme” with the text domain
parenttheme, and the child theme will be called “Child Theme” with the text domain
Notably, from the screenshots it seems that the in-flight entertainment is public domain (Le Voyage dans la Lune and Merrie Melodies), including the book, À rebours, considered part of the Decadent movement, which may or may not be significant? I ain’t no fancy art feller.
Bizarrely, this is being distributed by AMC Games (yes, the AMC of “Mad Men” and “Breaking Bad”), and this is their first game.
On why the Nintendo Switch doesn’t need 4K:
How many people are really looking at the Animal Crossing on their TV and thinking “no thank you, it’s not in 4K” or Paper Mario: The Origami King and dismissing the Switch because the graphics don’t have ray tracing? Literally nobody. Players come to Nintendo for quality IP, innovative titles, and long-lasting gameplay, not graphics.Raymond Wong, Input
This reminds me of the things Android zealots are always insisting the iPhone has to do, things that no iPhone user actually cares about, because Android zealots are “spec-heads.”
I do wish Nintendo would come out with a “Switch Ultra Lite,” which was similarly inexpensive to the Switch Lite but didn’t have a screen at all and was just a TV console.