Chris Hannah

Use Regular Expressions to Return to 140 Character Tweets

As we all know, Twitter is now changing the character limit of a tweet to 280 characters, from the original 140. I’m sure they have reasons, and I’m not here to argue against any of them.

However, if you find yourself wanting to go back to the “old Twitter”, where tweets were short, and we had to abbreviate things when we couldn’t fit all of it in. There is a way to achieve this.

The method is by simply hiding any tweets that do not meet your length preference. The most popular twitter clients for iOS and macOS (Tweetbot, and Twitterrific), have some form of muting feature, which also allow advanced muting with regular expressions.

Some people make use of this to mute certain hashtags, overuse of hashtags or @mentions, and some really advanced things. But for the purpose of checking a tweet length, you just need to see how many characters there are.

And that’s simply:

[\s\S]{MIN_LENGTH, MAX_LENGTH}

You use [\s\S] to match any character, and then use the lengths afterwards to specify a minimum and/or maximum length.

Just to explain it in a bit more detail, the square brackets are a way to define a collection of character matching rules. And the curly braces are sequence quantifiers, that can match minimum, exact, or maximum length of a match.

And then there’s the s and \S.

The \s is used to match a whitespace character, so spaces, tabs, new lines, etc. And the \S is used to match the opposite, all non-whitespace characters, So if you put them together, then you’re going to match every possible character. Which in a scenario like this, is all you need.

The Patterns

So now I’ve explained the scenario, and solution in a bit of detail, I’ll get to the actual regular expression patterns.

In this case, we simply want to hide all tweets that do not fit the old standard of 140 characters in a tweet.

However, we aren’t setting rules, but instead writing patterns to match tweets that will be hidden, we will need to inverse the logic.

Seeing as we only have one parameter – the maximum length we want to see, it will be very easy. Because now we need to say, if a tweet matches these conditions, hide it.

The conditions will be of course, that it is over the limit we set. In this example I will use the old 140 character limit, but you could set your own custom preference using this same method.

If we take that logic and apply it to the simple pattern I mentioned earlier, we can simplify it even further. As we’re not checking a maximum length, that’s irrelevant. We just want to hide anything over a certain amount.

Which leaves us with:

[\s\S]{MIN_LENGTH,}

You still need the comma in there though, as otherwise it will only match if it is the exact same length as the number entered.

Now the last part, the actual number.

Remember, this is not the length that we want to see, but instead the opposite. So if you want to see all tweets that are 140 characters or less, you need to check for anything 141 characters or over. (The same logic also applies to other limits).

So that makes it:

[\s\S]{141,}

Simple!

Using The Patterns in Tweetbot/Twitterrific

So we have the regular expression created, now we just need to make use of it in a twitter client.

Tweetbot is the slightly easier option, as you just need to navigate to Mute filters, and then add a keyword filter. Where you’ll have to type your pattern in, which will enable a regular expression switch, which you will have to tap.

In Twitterrific, it’s somewhat more confusing, but only initially. In this app, the mute feature is called Muffles. And you add a new muffle, to mute tweets just like Tweetbot. However when you navigate to the Muffles section, it doesn’t mention regular expressions, which lead me to initially thought they weren’t supported.

However, you can use them in Twitterrific, it just takes one extra parameter, a pattern title. You specify a RegEx Muffle in the following format:

Title :: Pattern

P.S. I know there is more formatting available, but it’s not relevant here.

So for Twitterrific, you might want to use something like this:

Classic Twitter :: [\s\S]{141,}

And that is it. Now you can hide away from the future, and pretend these long tweets just don’t exist.

Apps Mentioned:

The facts about Apple’s tax payments

I did not expect to see this post in my RSS reader!

Apple have written an official response to all the news regarding their tax payments, with a few statements on some recent business restructuring, and quite a few various facts about it all.

Apple believes every company has a responsibility to pay its taxes, and as the largest taxpayer in the world, Apple pays every dollar it owes in every country around the world. We’re proud of the economic contributions we make to the countries and communities where we do business.

Read the full post on Apple Newsroom.

Syria Joins Paris Climate Accord, Leaving Only U.S. Opposed

Lisa Friedman, writing for The New York Times:

Syria announced during United Nations climate talks on Tuesday that it would sign the Paris agreement on climate change. The move, which comes on the heels of Nicaragua signing the accord last month, will leave the United States as the only country that has rejected the global pact.

The Paris agreement, struck in 2015 under former President Barack Obama, calls on nearly 200 countries to voluntarily curb greenhouse gas emissions. At the time, only Nicaragua and Syria did not join, for very different reasons.

You seriously couldn’t make this stuff up.

Read the full post.

World of Warcraft at BlizzCon 2017

It happens every year, and as usual there’s some great news for World of Warcraft fans.

As WoW expansions usually come out every two years, this year is just to announce the expansion, and usually that’s it. One logo, maybe small description, and a year wait.

Except this year, in the opening ceremony, they showed three videos. One about a new feature, and then for the expansion there was a feature video, and even a cinematic trailer!

World of Warcraft: Classic

With the original version of WoW being one of the best gaming experiences for nearly all WoW players. Blizzard have announced that they’re working on a classic server mode for the game. So you will be able to play the original game, before any expansions!

I’m really looking forward to this!

Here’s their video announcement:

World of Warcraft: Battle for Azeroth

Okay, I won’t go too deep into the expansion here. Because so much has been announced, and there’s going to be so much more.

All I will say is if you want to know everything about it, check out the website.

But you also need to watch the features overview, and the cinematic trailer!


I don’t want to spoil anything here, because it is really impressive. Although I’m also looking forward to play the classic version just as much.

Qwiki is now 1/3 off!

My app Qwiki is now 1/3 off!

Purely because it hasn’t received so much attention recently (except the most recent minor update of course).

Therefore this discount will last until I release version 1.4. Which means a totally flexible timescale, anywhere between a few weeks and maybe even a couple of months if it’s a huge update!

💸⏳

Check out:

Qwiki Has Finally Received Another Update!

I finally got around to checking out the code for one of my apps, Qwiki.

Qwiki is a menu bar application, that lets you search and read Wikipedia articles. It can also open them in the browser, share differently formatted links, etc. But this isn’t an advertisement.

After updating it to 1.3 last year, I had other projects, university, and finding a job to do. So it got pushed right to the side. But I decided recently I wanted to modernise it, and maybe even look at adding new features.

That time hasn’t come yet, but I have spent the past few days going over the code, cleaning a few things up, migrating it to Swift 4, etc.

So in the mean time I fixed a couple of bugs, like when keyboard and mouse input get mixed up, escape key not always working, some design tweaks, and also added a preference to keep Qwiki open unless manually dismissed.

Now it’s been sent to Apple, I’ll have a few days off, and probably work updating another one of my apps. But in the very near future I plan on going back to Qwiki, and seeing what real features I can add!

If you have any ideas at all about Qwiki, then i’d be really happy to heat them. Even if it’s pure criticism, it all helps.

Check out the Qwiki website, or find it on the Mac App Store.

SOLID - Wallpaper Generator

Just over a week ago, I really wanted to set a plain colour background to my iPad. I had a quick look on the App Store, but nothing just did the feature I wanted. So I ended up starting my own mini project.

It took a few hours to make, and I had to make it support iPhone, iPad, and all the sizes they both come in. In the end it was probably as simple as the implementation could be, but that’s what I wanted myself.

The app can be broken down into 5 elements – three sliders for the hue, saturation, and brightness, followed by a save/share button so you can save the image or do whatever you want with it. Then there’s the background of the app, which shows the currently selected colour. So you literally get to see a live preview of the wallpaper.

Shortly after making this app, I thought back to my post on clearing out my current selection of apps on the App Store. But like I said in that post, some apps don’t require much maintenance, and I this app will fit in to that category. So although I do plan on keeping it up to date, you can see yourself how simple that will be.

Of course, I couldn’t charge for an app this simple. So it is available for free on the App Store!

A Backend Engineers Experience on Switching to an iPad Pro

Jannis Hermanns took on a rather interesting challenge recently, and it was all about working from an iPad Pro.

But unlike most people that make the switch, he’s not a writer, manager, or a designer. Jannis is a backend engineer, that uses some terminal in some hardcore ways!

In the summer of 2017, I wanted to know what it would be like to use an iPad Pro as my main computer. I found out that it can actually work, thanks to an iOS app called Blink, an SSH replacement called Mosh, iOS 11 and running stuff on a server.

His perspective/experience I find, is different than most other macOS to iOS switching articles, as there was a lot more technical issues that had to be solved.

But nonetheless, he managed it in the end.

Sadly for myself though, this switch isn’t something that I could do myself any time soon, as I develop 99% of the time using Xcode. Sure, I could probably run that on a Mac, and use a iPad to operate it. But what’s the point in that.

Read the full post.

IMDB Top Something Workflow

I just spent my evening making a workflow that requests the top however many movies from IMDB, parses the title, ranking, year, url, and short description, and adds them to Todoist as separate items.

It was a bit of a pain, especially as there’s a 2 second wait between each Todoist task. But otherwise it kept hitting request limits.

To make the workflow work properly, you’ll need to get an API token, but there is a link in the workflow for this. Oh, and of course you’ll need Todoist. Unless you just want to change that, but still use the extracted information.

Workflow: workflow.is/workflows…

Video of Todoist results: cl.ly/nN9o

My App Store Clear-out

As I’ve been getting back into development for Hydrate (a water intake tracker for iOS), I’ve been thinking about the sort of representation of myself as a developer.

When I think of a great developer, they usually have a small number of apps. Sometimes they’re all at a really high standard, but most independent developers I see, have one or two main apps, and a few more fun ones.

I have been developing for iOS/macOS for quite a few years, and I have to say most of them are dead, stale, or heading in that direction. So it’s time for a clear out. This might not be a very interesting article, but I certainly think the act of me writing this, will aid in the process.

For some background information, here is the list of apps that I’ve made for iOS/macOS, and their current status.

Name Platform Status Description
Hydrate iOS/watchOS Available. My current work-in-progress, a water intake tracker.
Pretty Regular Expressions iOS/macOS Available. Regular expression tool for macOS/iOS. Very simple.
Pixels Sticker Pack iOS Available. Some pixel art iMessage stickers!
AniMatchers iPhone Available. Just a fun memory matching game, with cartoon animals.
Bill Splitter iOS/watchOS Available. A super basic bill splitter. Mainly a small project so I could check out the watch SDK.
Qwiki macOS Available. My wikipedia menu bar app, which is one of my best projects in my opinion, which I will hopefully update soon.
Tap Gap iOS Available. A quick game for iOS, where you try and tap the screen when a line is between a certain gap.
Floppy Turd iOS Available. An awful, but funny remake of Flappy Birds. It took a sunday morning to create, and that was where I left it.
TinyMe iOS/macOS Removed. One of my first few apps, they used the goo.gl api to shorten longer links, but they aren’t an issue anymore.
Postie macOS Available. I used to blog on Scriptogram, and this was a basic Markdown editor with publishing built in. The service has unfortunately shut down.
The Girlfriend Helper iOS Removed. I think the first app I made. It was an app that suggested message you could send to your girlfriend depending on the event type.
Halloween FX iOS Removed. Basic soundboard app, which also featured a timer so you could hide your phone and scare someone.
The Farm iOS Removed. Even more basic soundboard app, just contained farm animals.
Bug Splatter iOS Removed. This was a weird one, there’s multiple levels of bugs/difficulty, and the aim was to splat as many of them before they reached the end of the screen.
Whack iOS Removed. A pretty simple whack-a-mole game, but with pixel art, and funny noises.
TextShot macOS Never made it. This was a really fun project to work on, it was going to be an app where you could select a bunch of text, and it would generate a picture from it, even including multiple different styles. Sadly the MacBook I was using at the time died completely, and I wasn’t clever enough to think about source control back then.

Okay, I didn’t actually know I already removed a few of these already. But there’s still some clearing out to do.

My aim is to have a small number of applications, that either are stable, and need hardly any maintenance, or ones that I can regularly keep updated, and are proven to be worthwhile.

So if you just take the apps I have available, there’s 9. Well one isn’t released yet, but it’s in progress.

  • Hydrate
  • Pretty Regular Expressions
  • Pixels Sticker Pack
  • AniMatchers
  • Bill Splitter
  • Qwiki
  • Tap Gap
  • Floppy Turd
  • Postie

If I separate them into the groups I mentioned before, I’m left with this:

Maintainable Apps:

  • Hydrate
  • Qwiki
  • Pretty Regular Expressions?

Minimal Effort/Stable Apps:

  • Pixels Sticker Pack
  • Tap Gap

Left over:

  • AniMatchers
  • Bill Splitter
  • Floppy Turd
  • Postie

That was pretty quick and easy, and it sort of represents what I already had in my head. Out of the four left over, they all have very good reasons why I don’t want to support them anymore. Low download numbers, super old code, and lack of interest to work on them again.

So, they’re be removed.

That leaves just five remaining apps, three I feel that are maintainable, and the other two are kind of eternal to an extent.

Of course Hydrate will stay, I mean I haven’t even released it, and it’s still in active development. Qwiki is stable, and my most popular app, so that will also stay.

Pretty Regular Expressions however was initially well taken, but I haven’t had any desire really to go back to it, and improve it. I will have a look at the code again, and hopefully I can add something to make the app even better soon.

Pixels Sticker Pack is a bunch of images, and I can’t see myself ever needing to update these. They’re fun, and I still enjoy using them!

That leaves Tap Gap, it’s a simple game, that still works fine. I’ll certainly make a few changes and support the iPhone X soon, but that is only a minor issue.

So the remaining apps, along with their pricing are:

Name Price
Hydrate Not decided.
Qwiki £2.99
Pretty Regular Expressions (iOS/macOS) £0.99
Tap Gap Free
Pixels Sticker Pack Free

Not a bad bunch!

I’ll be checking out a few of these projects today, and maybe even get thinking about the changes/updates I can make!

If you want to follow on with more detail, just follow me on twitter!