Wednesday evening, as an addition to my regularly scheduled shift, I got to play locksmith, first attempting to fix the lock on the office door, which wouldn’t lock for me, and then replacing it with the old one.
Toby's Log page 83
Bird rescue attempt
Today (yesterday), I spent around three hours getting a bird detached from a tree in the back yard. It was just hanging there from its leg, and it was hard to tell how it was attached. It was pretty high up and not reachable with any pole-like implements we had available from my ladder. My roommate helped for a while, but had to leave for work. I eventually succeeded in getting the bird down using two ropes, one put in place by throwing with a Kong dog toy on the end, the other raised with a garden tool tied to a stick. The ladder wasn’t entirely stable with the long combined pole, and the rope-throwing took many tries. I used the rope to break the branch, causing the bird and branch to fall. The branch was still alive, so the operation took a while even after I got both ropes in place. I set up some yard-waste bags and a towel below the bird to soften its landing.
Continue reading post "Bird rescue attempt"Dreamhost must’ve had an outage of some sort this (last) morning. I noticed a little after 11 that I couldn’t upload anything to or log into my (shared) server. My sites were inaccessible. I tried the sites of a couple other people I know using Dreamhost (also shared), and they were also inaccessible, so it must’ve been something somewhat significant. Strangely, nothing relevant was on Dreamhost status. I tweeted about it at 11:20 and got a response from DreamhostCare that they were looking into it. They didn’t say anything more, but I noticed things were up and running again around 11:42. I found later that it must’ve been a DDoS on their nameservers. Outages have been rare, but certainly annoying when they happen.
Duplicate selectors: Increase specificity without being more specific
CSS has a concept of specificity wherein more “specific” selectors take precedence over less specific. Sometimes specificity rules cause a set of property values to be applied while another is desired. This can result in the developer increasing specificity on the desired set to outweigh the other set. When I’ve needed extra specificity, I’ve often use an ‘html’ class on the <html>
element or a ‘body’ class on the <body>
element. The downsides of are it:
- is more specific, as in precise, meaning the selector won’t match in a document without those helper classes.
- has a performance penalty for needing to check a(nother) parent element of the target element.
- only allows one more unit of specificity at the class level for each parent used.
Today (yesterday), I found a better way that can add any amount of class level specificity (weight) without being more specific (precise), thanks to CSS Wizardry. I’ve been doing this CSS thing for a while, but I hadn’t realized .foo.foo
would match <div class="foo">
. In essence, you can duplicate a selector and chain it onto itself to create an equivalent selector, but with double the specificity. You can duplicate it as many times as needed to get the desired specificity, e.g. .foo.foo.foo.foo
to override .foo.foo.foo
, without requiring any parent selectors. Besides the benefits already mentioned, it could be seen as more explicit in its purpose than using parent elements, because there is no other reason to do it. I will have to start using this.
Pretty great to see (TV, first half) / hear (radio, second half) the Cavs set all-time 3-point records. Found a video of all the successful shots.
WordPress.com redirects don’t support HTTPS
Gah. Apparently wordpress.com is discouraging ‘https’ for self-hosted blogs: Their redirection service does not allow any protocol but ‘http’. I could swear it did when I first set it up, as I remember typing in my URL with ‘https’ and I thought I tested it with curl -I
to make sure it works, but the docs have an explicit note saying:
Note: Site redirects will only point to a non-ssl ( http:// ) url.
I don’t remember seeing it before, but the wayback machine suggests it was there since 2013, well before I switched to self-hosted.
Continue reading post "WordPress.com redirects don’t support HTTPS"Jetpack’s sitemap plugin has gotten an update or two since I found it listing the wrong protocol for my URL’s, so I decided to give it another try. Now the protocol seems to be correct, so I am leaving it enabled and hoping it helps Google to get my URL’s indexed as ‘https’ instead of ‘http’.
Sending email attachments with PHP `mail`
I recently had to set up a PHP script to send an email with an attachment. With the current version of our CMS, we have swiftmailer available, which would make this easy, but for this site, I didn’t have it easily available. I considered bringing it in, but since this was just a simple script, I decided to give a go at doing it directly with PHP’s built in mail()
function. I found an answer on StackOverflow to guide me. Many respondents to that question recommended just using a library, but the answers that didn’t seemed reasonable.
It took me a number of failed attempts to get the headers and line-breaks just right so that both the email message and attachment sent properly, but I got it working. The code of my solution was fairly specific to the application, so I’ve modified it to make it more generically applicable for this post. The (untested but generic) variant of the solution looks like:
Continue reading post "Sending email attachments with PHP `mail`"SCSS rgba color fallback mixin
Browser support for rgba
colors is very wide, basically working in everything but IE8- and really old browsers. In the name of progressive enhancement, it’s still good to give those browsers a fallback, the simplest being the solid version of the same color. This can be done by putting the property twice, once with a solid value and once with an rgba
value. The non-supporting browsers will take the solid color and ignore the rgba
, while the supporting browsers will take both, with the rgba
overriding. As an example: color: #fff; color: rgba(1, 1, 1, 0.6);
.
To that end, I created a mixin to do this automatically, similar to my remFallback
mixin:
There must’ve been a flexbox bug in Firefox 45. Today, it was brought to my attention that nav was getting cut off on a site. I added a flex-shrink: 0
to ensure the logo shrank to accommodate, fixing the problem in Safari, but not Firefox. Thinking it odd that Firefox was behaving so differently from other browsers, I decided to check for an update, and 46 happened to be available. After updating, the problem disappeared. I’ve ran into browser bugs with flexbox before.