Subtitles and timed texts

I am currently working on a Swift parser for various types of subtitles and timed texts. As always the Xcode Playground makes it very useful to try things out, although I would like a way of adding some sort of unit tests.

At the moment my aim is on trying to see what sort of resources are available online; my interest is in working with foreign languages to help teach students or to improve my own knowledge.

The following is some code that as a way of trying to identify what type of timed text the user has given us. It uses a NSScanner to try and look for features and although it doesn’t work with everything that I found1, it seems to work well most of the time.

Obviously this code is for when the user pastes text that they have found online.

  1. I found some .lrc files that have extra/invalid text at the start 

From cloudpebbles to cadigatt

cloudpebbles is dead. Long live cadigatt

I have been wanting to rename the cloudpebbles website for a while. I have always liked the name and it has been around for quite a few years now, but at this point it is just a bit too similar to another website1 and is easily misplaced. So, at this point, my other website is going to be cadigatt.com and it will contain everything that was on cloudpebbles.com.

  1. cloudpebble.net – the rather interesting online development tool for the Pebble watch 

Roman Numerals & Swift

I don’t know if I will convert any of my existing iOS apps into Swift, but I do like the idea of it and the playground, in particular, is a nice way of experimenting.

I have made a simple roman numerals converter (2014 -> MMXIV) in Swift which you can find below or on GitHub . The main thing that I like is the enumerate and the for j in 0..<div although it would be nice to have something like j.times do {}.

Originally, I wanted to use a dictionary, but since they are not ordered I used two arrays instead, but enumerate does keep it clear.

Update: an alternative way of doing can be found in the following gist. This time I have used tuples rather than two arrays, which is a bit easier to read perhaps. I no longer need to use enumerate and the for loop no longer cares about the index for _ in 1...count.

More importantly, the function returns an optional string, so it is clear if the conversion worked or not. Alternatively, I could just check for an empty string or nil, but for the upcoming roman to arabic code, that wouldn’t make much sense.

Sketch plugins

I have been working on some plugins for the rather nice Sketch app. The plugins themselves don’t do anything particularly special, but I wanted an easy way of being able to create particular images.

The plugins (and sourcecode) are on GitHub and there you will find instructions on how to use them.

Randomly placed plugin

I made the plugins because I needed two things: firstly I needed to fill an artboard with copies of an object, and I wanted them to be randomly placed and randomly rotated.

Randomly placed

Marching plugin

Secondly, I wanted to clone an object into a group that looked like they were marching/walking. This is different to the Make Grid... feature, because alternate rows are offset.

Marching plugin

Jekyll

Just to let you know, this website has been recreated in Jekyll using the Hyde theme and perhaps it might have some more content in the near future.

Links probably don’t work, and in some places definitely don’t work, but your search engine is much better than me.

For more timely news, I can also be found on twitter as @kumo.