Jess and I headed to Kin Beach in Vernon to take some maternity shots this weekend we’d been planning it for months, and they turned out better than we hoped. (more…)
I’ve been working on a Slack App that shows recent Slack posts and activities. The majority of recent posts include emojis, and problematically Slack’s API doesn’t store and send emojis as characters, they’re down-converted to their respective shortnames, then wrapped in colons (presumably for universal support – it appears to be a standard practice of some sort, as many use it).
Basically I was just looking for converting
:thumbsup: to convert to:
👍 which’d show: 👍
Simple enough task, but I couldn’t find any resources to do it (and if you’ve discovered this blog post, you’ve probably discovered that out too). So, starting at the top, Slack in their API docs refers to using github.com/iamcal/emoji-data as their emoji shortcode source. This repository does have a PHP script, but it doesn’t convert as simply as I wanted it to, and it’s huge.
Taking a step back,
iamcal/emoji-data has a enormous master
.json file, basically a database of each emoji and all variations therein. Taking this file, and running through it with some basic PHP, we can build a simple array of
shortcode => hexcode. Doing this was almost too easy:
We then take the output of that file, and create our own
emoji_unicode.php file, an array housing the values output above. Which looks like:
Much smaller and easier to work with. 97% smaller actually coming in at: 35KB instead of 928KB. I’ve hosted the file on github here.
So with a simple array to call back to, we can just include it, search the string for the colon’ized shortcode emojis and replace with hex code, like so:
> hello 🌎 . it’s 🔨 ⏱.
This works with
:skin-tone-x which surprised me- I guess the
skin-tone is a “invisible” character of it’s own, that basically gets compounded with the emoji character before it, and changes the emojis that way. Pretty cool, so no extra work for that. (And no, this method doesn’t work on devices that don’t support emojis).
Here’s a neat little widget that’ll fetch your currently-reading and read books from your Goodreads shelf, and show them as a widget for either Panic Status Board (DIY Panel), or your website. Code is inspired and built upon from a great little 2013 script from flapane.com
First, some styling:
Setup, query and cache:
Read and output:
You’ll need to create empty file
goodreads.cache manually, in the dir of the script.
I’m not entirely sure what happens when there’s more than 1 currently-reading. I never bothered checking.
$image_fix is nasty, I don’t understand why the Goodreads user API would not return a cover when the cover is present on the Goodreads site itself. I had to do a fix for one of my books, manually tracking down the cover’s URL on Goodreads.com.
<!--?= (98/147)*54 ?--> is my ..interesting.. way of doing proportional scaling on the fly. Old width/height values kept prior to overwrites for reference; makes sizing your widgets books covers to much easier.
filter: grayscale(100%); Keepin’ it real with Kindle, grayscale the covers.
Frustrating problem I’ve had happen more than once. Your WordPress site returns a 404 (which you may be relying on), but it shows a HTML (server generated) 404 page, not a WordPress 404 page.
Solution for apache is simple: let the server know to revert to
index.php when the header is 404, set the following in
I love my Kindle PW 3 (FW: 126.96.36.199), but I hate the screensaver, it’s like Motel art. Thrift store art. It’s terrible and only belongs on napkins at the dollar store. I would Jailbreak it, but the current FW version has made it pretty much impossible without soldering things.
So what’s left to do? I can continue just placing it face-down on my nightstand, or, come up with a concept design and try to get someone at Amazon to read it!
I understand the non-native support for managing screensaver locally: say if a folder
/screensavers/ was accessible via USB; users would be uploading bad resolutions, huge raw 12mb files, etc. and the cropping and grayscaling would be unpredictable and unsatisfactory. Any local image editor, would not likely work given the Kindles graphic processing. So, that’d be a nightmare, hundreds of support calls. It’d be far worse if the Kindles Browser had to be used for screensavers; even more problems.
However, Amazon has an eco system already in place to manage more advance things like this: amazon.com – Account – Manage Your Content and Devices . Here is my concept on how easy it could be to manage custom screensavers (for users who’ve spent the $20 to opt out of the Ads):
Pretty simple implementation, using no technology that’s not readily available. Set screensaver pushed to the Kindle just like a device name-change or a new book purchased via a computer!
Users would upload normal coloured images, of whatever resolution, then an HTML5/JS image editor would auto black-and-whites, and crops for the proper aspect ratio. Taking things a step further, since converting to grayscale is never what one expects: make things a bit more customizable with brightness and contrast controls. This would be okay for novice users to understand (as it’s all the same steps Instagram uses, or Facebook profile pictures).
Important: THIS IS A CONCEPT. Not actually a tutorial. I know you’re desperate for this to be real: so am I.
One of my servers handled object buffering fine, the other wouldn’t partake. After hours of searching, and changing php settings, deep in a thread I found a solution for stubborn servers. If the following simple script doesn’t work out the gate:
Try this instead, from a gentleman named Roger in Stackoverflow :
A nasty work around that works beautifully, and I hope it helps you.
Always a pain, finding the actual POST TYPE object of a Navigation Menu. This is the most straight forward solution I found to get the relation array.
Which will return
Logo concept for my sister in-law’s startup interior design studio. Full brand package in development.