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.
Toby's Log page 87
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.
Globbing files including dot-files
Normally globbing for the wildcard * will find all files in a directory except for ones beginning with a .. Sometimes I need to get all files including the dot-files. The pattern .* will find these hidden files, but will also include . and .., referring to the directory and its parent. As I’ve learned in the past, this can be dangerous with commands like rm, (i.e. you running rm -rf .* to remove dot-files will remove more than expected). Today, needing to get all files in a particular path in PHP, I sought a solution. A post on a Perl forum gave me a solution using curly braces: {.??*,.[!.],*}. Braces basically allow multiple comma-separated patterns to be evaluated. The three patterns are:
.??*matches a dot followed by two characters followed by any number of characters..[!.]matches a dot followed by a single character that isn’t a dot. This is needed since the previous pattern doesn’t match this case.*is the normal wildcard glob, matching all non-dot-files.
In PHP, the glob() function requires the GLOB_BRACE flag to use braces. An example might look like: $files = glob($path . '/{.??*,.[!.],*}', GLOB_BRACE);. This did exactly what I wanted.
Moving folder symlink and trailing slash
It caught me by surprise that if you use mv on a symlink to a folder and have a trailing slash on the path, it will move the entire original folder rather than the symlink. As a simple example, if you have a symlink ‘symlink’ pointing to the folder ‘original’ and run mv symlink/ new-symlink, you will end up with ‘original’ now being named ‘new-symlink’ and a symlink ‘symlink’ still pointing to the now non-existant ‘original’. Luckily, merely reversing the arguments will move the folder back to its original location: mv new-symlink symlink/. The symlink becomes like a magic portal. I probably wouldn’t have run into this if it weren’t for the ‘fish’ shell adding trailing slashes when doing tab completions on folder paths or symlinks to them.
Sometimes, I feel like an alien, sent down to observe the humans.
Finally finished my taxes and got everything mailed. Always a relief with a tinge of worry that I did something wrong. I’m getting money back for the first time in years, and was able to pay this years first quarter estimates with over-payments of last years estimates. This was due to me making less than previous years, but it did feel good to not have to deal with the estimates.
Except, of course, for Cleveland, part of CCA. CCA makes you, with the way the form is set up, subtract your over-payment from the whole year estimate and then pay a quarter of the remainder. Even though my over-payment was more than my estimated quarterly owings, I still had to mail in a check. It’s like a penalty for over-payment. And if I instead took my over-payment as a refund and then payed the real quarterly estimate, they have separate mailing addresses for returns that have refunds and returns that have payments. Not sure what I should do when one return is both. Confusing. Which is a common problem with city taxes. They always seem to have things that are vague and confusingly worded, set up differently than federal and state, and there isn’t the software guidance or countless web articles, posts, and answers to help that there is for federal and, to a lesser extend, state.
As I say every year: Next year I should probably pay an accountant to help me with this stuff.