tween.js mega changes

Yesterday I had my every-two-months lucky day in which I could sit down and work on tween.js, and DID I GET THINGS DONE!!!

The first thing I did was to get rid of the minified version. Since the build process wasn’t fully automated, I often forgot to produce and check-in that minified version, and people who used it would get all sorts of weird errors that I didn’t see (specially in Safari and iOS, as the polyfills we added would be in the uncompressed version, but not on the minified, sigh!).

Then I started using semantic-release as my invaluable helper for producing releases. Each time a push to the git repository happens, another service (Travis) runs a battery of tests to make sure nothing is broken. If the tests pass, semantic-release will get in action and (probably not in this order):

  • determine what’s the next “semver” for the package. This is a function of the type of commit you made (a bug fix, a new feature, docs, chore…). Important / breaking commits will cause bumps in the first digit, etc. (I suggest you read more on semver if you’re interested). The type of commit is specified by having the commit message follow a certain syntax. E.g. a feature will be feat: implement feature A
  • tag the commit with the version. E.g. v16.0.1. I believe this is what bower people use and desperately need, and I never provided because I don’t use bower and so didn’t notice.
  • create a github release changelog thingie in github. These go to the releases page in github
  • publish the new version of the package to npm

I think semantic-release can do so much more than this, but just having all these steps performed for me is A W E S O M E. So once I established this “infrastructure” I could go on and fix many other long-standing issues and also merge PRs and address questions.

Since we don’t have to produce a minified version, I got rid of gulp which is what I was using it for. Installing tween.js with npm is now very very lean because I also added an .npmignore and so it just essentially installs the code of the library only. Your trees will not include the examples anymore. Not that it was incredibly big but every byte counts to some people, it seems 😛

I also added jshint (for code correctness) and jscs (for code style) verification as part of the test suite. This was something that would put me off reviewing PRs… and specially explaining to people that it was not OK to change the whole whitespace in the file, or that they should respect the existing guidelines (even if it’s in the contributing file that very few read). So the rules are now there, and everyone has to abide to them, or the tests don’t pass and so the PRs are not accepted.

Interestingly, I added these steps using the advice in Kate Hudson’s talk from Nordic.js front-end automation with npm scripts, where she showed how you don’t actually need a task runner–I recommend you to watch it! Or check out her reading list on the topic.

Next up was dealing with a ton of sorta old and sometimes outdated PRs that had been lying in the guts of github for months. As I explained in my previous tween.js post, something had happened and I hadn’t even seen the notifications for these.

I prioritised FIXES first. Many people are coming up with some novel ideas and features, and I’m grateful for that, but I decided to focus on accuracy and robustness for now. Some aspects of the code are a bit obscure and I am not sure I understand them well, mostly because I just merged them in when someone proposed them, and now I’m paying the price when strange edge case errors are reported.

Of course, I’m still not done by any means, because there was a massive backlog and the day only has so many hours, and I’d like to do human things such as sleeping, etc.

This is brings us to this interesting paradox: many people use tween.js, including big agencies who charge a bunch for their projects, but only a very few submit code or respond to my pleas for help. Maintaining a JS library has become way more demanding over the years. Back in 2011 people didn’t care about npm, bower, tags and releases and what not, so working on tween.js was way more simple and less time consuming. I could have just put a zip file on a website, and people would be happy with that, for all that is worth.

But since I changed roles at Mozilla I am travelling a lot more, and it literally devours your time. I am not complaining about that, but I need quiet time to sit and get heads down on code, and I’m not having much of that lately. Mozilla supports me working on tween.js but I do have my own work duties which take priority. All my coding time is happening during working hours, and when I’m off work I like to enjoy my free time doing things such as being outdoors or just talking to people face to face, not via a bug tracker. Or despair about the list of issues and PRs growing and me not having time to even acknowledge them 😩

But before totally blaming open source for its toxicness, I decided to own this a little bit myself, and totally revamped the README file to make it a bit more welcoming and clear (I took heavy inspiration from Express). I have also filed some bugs and tagged them as help needed or good first bug respectively. If you enjoyed tween.js and want to give back by contributing to these bugs, you’d gain extra points of awesomeness.

People like roadmaps, so this is what I’d like to see next:

  • Review all pending bugs and PRs and resolve or close them.
  • Fix the things that have to be fixed and ensure all code is tested and clear before adding new features, because it is getting to a point where it is unwieldy and scary to even look at a diff (what even does this thing do!?). Hopefully the new automation will help here, and we can focus on logic and not on chores!
  • Divert all new feature ideas to the future ES6/ES2015/ESWHATEVER version of tween where everything will be super modular and you should be able to use parts of it as you need and hack other types of tweening engines as you see fit.

This is it for now. Thanks for reading, and happy tweening!

Events coming up next: August and September

Here’s where I’m going to be next:

  • August 27th: Async.JS, Brighton. James and Alastair have worked tirelessly since last year so I move my lazy noble parts from London to Brighton and go talk about something.
  • 9-10th September: NordicJS, Stockholm. Very excited about being back in Stockholm!
  • 15-16th September: SmashingConf, Freiburg. Me in a SmashingConf!!!!!!!! AAAAAAAH!!!
  • 22nd September: SmartWebConference, Bucharest And back to Bucharest in less than a year, but this time I get to walk on the city and not just use its airport for a connecting flight! Wooohoo!

Yes, there’s no JSConf.EU on the list. I’ve been going to Berlin in September for the last two years and while it’s great, I don’t think I can make it for the third year considering how busy my previous weeks will be. I have events in October too, and I would like to be able to make it to them in one piece. I’ll see you all somewhere else, I’m sure :-)

Also: three free tickets to SmartWebConf for students and underrepresented developers

As Debbie Millman says:

you can talk about making a difference, or you can make a difference, or you can do both

So I’ve also decided to convert my speaker fee from SmartWebConf into tickets for students and underrepresented developers who wouldn’t otherwise be able to attend the event. To apply just email contact at telling why you want to go (and if a student, attach a copy of your student card). More info here, as well as a picture of the one and only Bruce Lawson with last year’s students.

I hope this makes a difference. I also like to remind myself of Anika Lindtner‘s “a simple gesture from your side can change somebody else’s life” (watch her talk). Who knows, maybe these tickets will have a way greater effect than any of us can predict!

And I was also in Manchester last week. Sorry if I didn’t announce it, but I’ve been superhyperbusy lately.

“An introduction to Web Components” at Manchester Geek Nights

I was in Manchester last week for a Manchester Geek Night meetup organised by ThoughtWorks North. I gave an overview about Web Components, and potential issues regarding accessibility / SEO, and using them with some of the popular frameworks:

Slides: onlinesource code.

It’s kind of similar to my jQuery UK talk, but updated, because many things have changed since March.

Yet people in the audience are mostly still not using Web Components or don’t plan to do so for the time being. They are mostly happy with the UI options provided by their framework of choice, or what they do doesn’t really justify the investment that Web Components require.

I am however hopeful that browser vendors have finally agreed on something and things are starting to move towards a minimal, commonly agreed with, implementation of something-web-component.

But I am going to politely decline doing talks about Web Components until the tech is a bit more stable. I am not working actively with UI/Web Components stuff at the moment so preparing these talks requires a huge investment of time (as I don’t like telling lies, or lies by accident).

And about 500 km later…

The Prudential ride was held last week-end in London. Two years ago I walked past Green Park when the ride was happening, navigating the hordes of people in their bikes in the “Fun Zone” and wondering if I’d ever ride a bike with their ease too.

Fast forward to last Sunday, when I biked for 18 km, just for fun! Not in the race (although it could have been funny to see a Brompton-powered cyclist), but just around London. How different things are now–for the better!

Although I got the bike in late November 2014, I just started to track my rides at the end of March, out of curiosity (how fast am I? how long is my daily ride?). Since then I’ve cycled 445 km, in 66 rides that have taken me about 32 hours total.

I’m quite distrustful of all other drivers, cyclists and pedestrians, and the only time I almost got hit by a van was because I trusted them too much–then they “cut a corner” and almost crunched me against the pavement; luckily I was quick to yell at them and jump aside but I still got a very minor bruise on my arm. Still I think it’s a good rate of accidents per kilometer, and I intend to keep it that way.

I am now super fast at unfolding/folding the bike, and also lifting it upstairs. I replaced the front light that the shop sold me initially with a rechargeable USB light which has also WAY more lumens. I’ve also learnt to pump the tires myself and to grease the chain–it’s very relaxing and satisfying! I also got a camera on my helmet–a bit for documental reasons but mostly acting as a deterrent (the red LED on front when recording seems to have put an end to the territorial behaviour of some drivers, it seems). I wish I hadn’t had to get the camera. Ah, if only the police were doing their job… If only the multiple traffic cameras in London were put to a good use… If only…

But other than that, my worst issue right now is that sometimes I’m in too much of a good shape and my muscles are too much for my bike, and so even with the longer speed I am still too fast for these wheels. I keep having to remind myself that this is not a road bike and there’s no need to bike SO FAST. I also wish that my issues are always like this.

In parallel to getting a bike I also kept up with my running, using one of those couch to 10K apps. I started tracking it as well–I’ve run about 240 km since then! And now I do not dread running for buses or planes as I used to. It helped me catch a plane on time on a very tight connection last month. It was worth the effort!

In contrast, the first time I intentionally went running, a little less than two years ago, I barely ran for 100 metres before I got totally out of breath. My lungs hurt. My throat hurt. It was a horrible feeling and I was ashamed to hear the answer to what have I done to my body in the last 20 years?! But now I can run 3 km non stop in a good day, and still walk after that.

I do not want to brag with this post–all the contrary. I want to share my joy and amazement at the fact that even the couchest of potatoes can turn into a somehow fit human.

The trick is to practice and to be persistent.

And not comparing yourself against others, but against yourself. Every improvement is a win, even if small! Last year I’d run 2.4 km on a good day. Nowadays that is less than my fun runs.

Many times I wake up and don’t feel like going anywhere but then I remind myself of that nice exhilarating feeling when I’m running up a hill that I used to have to stop mid-way because it was too steep, and now I run in about three minutes non-stop, and then I put on the sporty clothes and just do it. And if I don’t run, walk or bike on a given day I feel like I’m missing the activity!

Something else that is cool: I don’t mind if it’s rainy or sunny anymore. There’s again something really exhilarating about both aspects. If it’s raining I just love that I don’t care that it’s raining–I just put my hood on and do my thing. Yes, drops get in my face, but I just brush them aside. If it’s sunny, it tends to get pretty warm so I can wear tank tops and that means I get tons of vitamin D! So many people are complimenting my tan this year but… it’s just the English sun! 😉

It also helps if you have an encouraging circle of acquaintances and friends. There’s a ton of people in the office that are into sports and they would always talk about going to the gym or to the climbing centre, or cycling, or… Jen was also a great inspiration when she shared, nonchalantly, that she couldn’t run for more than a few metres before, and now she was running kilometers! And Belén started running as well and shared her progress and tips. Apparently at some point I figured that if they could do it, so could I!

And if I could do it, so can you! 😀

Possible futures, and nodebotting

You might remember that I was sorting out my music collection. This involves having to use iTunes for adding cover art and editing metadata and blah blah because I’m using a Mac and it seems that everyone has given up on making anything (anything!) better than iTunes.

So iTunes is this big huge mass of software that attempts to do everything at the same time and does nothing particularly well, and we’re all using it because there’s not much more else available. Talk about user choice, wooops.

Yesterday I was realising this horrible situation and started a parade of tweets:

  • I never know whether to cry at the immense UI failure that iTunes is or just laugh at it so ironically being the flagship product at Apple
  • When using iTunes I’m afraid to click on buttons because I do not know what havoc will that unravel. Things move around without explanation
  • There are buttons that turn into something else, something elses that act like buttons, data losses, weirdnesses, ugh
  • The worst is: there doesn’t seem to be anything better in Mac? (!?) 😭PLEASE PROVE ME WRONG, I BEG YOU 😭

Someone suggested Vox, which I haven’t tried yet. But seriously–only one suggestion! is that all that there is? I ended up thinking again about writing my own “player”. Except it would not be a player, or at least, not just a player, but I was thinking more about a sort of jukebox with sync. Of course I have other things to do right now so that’s probably not going to happen unless I win the lottery I don’t play.

I was in a good mood this morning so I decided to pretend I was funny and laugh at this whole mess with another tweet parade:

  • the year is 2030.
    you can do grocery shopping, pay council tax, vote for your fav eurovision artist and resolve git conflicts with iTunes
  • in 2045 iTunes finally gains sentience and writes the code for you. all commit messages mention titles of U2 songs
  • 2525 it is revealed that iTunes has acquired Skynet (to the tune of Visage’s In the Year 2525 but poignantly sung by Bono)
  • 3001: Frank Poole begs to be killed again by HAL 9000 when he sees iSkynet in action

And instead of sitting back and maliciously grin at the idea of this actually happening and how 2030 is in fact quite close in time and I could be saying “I told you so” in only 15 years, I grabbed my bike to go to Tableflip, the home of Nodebots in London, for a lighterweight NodeBots day.

Good things: it was a gorgeous day (specially compared to yesterday’s where it poured with rain for about 90% of the time), and I got lost in Dulwich which is a beautiful, albeit very adhoc and non-grid at all area, so it’s even a pleasure to get lost and wander around those streets.

Bad things: there was nothing bad about getting lost because there was absolutely no rush at any point during the day.

Oli was a fantastic host and he made us bacon sarnies and coffee. Their space is a-ma-zing. It’s full of tools old and new, and equipment and things and dust from sawing and weird mechanical and chemical smells, and flying things in various sizes and shapes, and there’s some other business where someone is building bikes. BIKES!!! It’s all super cool and I came back very excited about making stuff, even if I just managed to sort of use Johnny Five to control a servo:

Meanwhile, Tom was hacking on his Maschina and making it emit various sounds with JavaScript, Alex was transferring PCB positives onto another surface using an electric iron and two other guys were doing fantastic hacky stuff as well. I also got to hear about Fritzing and it looks really good.

I’m glad I got to use part of the equipment in the Spark core kit I got at JSConf.US 2014 which I still hadn’t had time to use. I’m sad I didn’t get to use the Spark core itself because the nodeschool nodebots workshop is designed for Arduinos and I wanted to see something happen physically and not just emulated, but I am certain I’ll be able to research this before iTunes can also talk to Spark devices via iPay or whatever.

Playing with hardware is fun. I am an almost total newbie in this field. I keep forgetting which pin is the N pin for LEDs (it’s the short one, I just looked it up today). I keep forgetting how to read resistors and how to connect things together. It’s all fine: it’s on the internets, somewhere, or alternatively it comes back to me once I get started. I have absolutely no expectations for what I’ll do and so I can’t let myself down if I forget everything from the last time I played with hardware. It’s OK. It’s a game. It’s fine to forget the rules, you can always re-read them.

And if you haven’t had enough future scenarios, here’s also this very funny article: A horror story that starts with Twitter.