How to make an iterable Swift collection type

Sometimes it’s useful to implement custom collection types. For example, you may want to keep the order of the iteration of the objects in the collection hidden from the consumer. Here’s how you can make an iterable Swift collection type with SequenceType.

Continue reading How to make an iterable Swift collection type How to make an iterable Swift collection type

Avoid Polluting The Global Namespace in JavaScript

In this blog post I will show how to avoid polluting the global namespace in JavaScript.

What is this namespace you speak of?

When we give our components names in our code, the interpreter adds them to a namespace. We can reference the component later by using that name. In a certain namespace, a we can only use certain name to reference, or point to, one thing (at a time).

The global namespace is a namespace that is common to all JavaScript code in your JavaScript interpreter. It’s also known as «global scope», and I use the terms loosely and interchangeably here, even though they mean different things.

Continue reading Avoid Polluting The Global Namespace in JavaScript Avoid Polluting The Global Namespace in JavaScript

Start using Swift with Parse.com

Unfortunately Parse is closing down in 2017, but we have found a great and actually local (to us) service: AppStax.

We decided to develop an iOS app to interface with #lillygram. #lillygram uses the popular «Backend-as-a-Service» Parse.com. Here’s a quick overview of how to get started using Swift with Parse.com, based on our experiences so far.

Other useful resources:

Continue reading Start using Swift with Parse.com Start using Swift with Parse.com

Unfortunately Parse is closing down in 2017, but we have found a great and actually local (to us) service: AppStax.

Elegant Data Binding in Objective-C with ReactiveCocoa

If you’re developing apps for iOS then you should be (painfully) familiar with the Key-Value Observing (KVO) pattern. Says Chief NSHipster Matt Thompson about KVO:

Ask anyone who’s been around the NSBlock a few times: Key-Value Observing has the worst API in all of Cocoa. It’s awkward, verbose, and confusing. And worst of all, its terrible API belies one of the most compelling features of the framework.

Unfortunately, KVO seems to be the best way to natively achieve data binding on the iOS platform.

Continue reading Elegant Data Binding in Objective-C with ReactiveCocoa Elegant Data Binding in Objective-C with ReactiveCocoa

How to handle timezones in Parse.com

Unfortunately Parse is closing down in 2017, but we have found a great and actually local (to us) service: AppStax.

Update: It seems the tutorial might not be valid any more as there are new versions of Parse and Moment. I do not have time to update this turorial as of now (March 2015).

Ever needed to handle dates and time zones in Parse?

(Jump straight to the full Gist example if you want to skip the explanation.)

moment

Continue reading How to handle timezones in Parse.com How to handle timezones in Parse.com

Unfortunately Parse is closing down in 2017, but we have found a great and actually local (to us) service: AppStax.

Can You Patch Your Favorite Third Party Dependency?

Who hasn’t used a third party dependency in their software project?

The other day I came over a blog post by Justin Williams that offers a somewhat unorthodox perspective on deciding whether to use a third party dependency.

His general answer to the question «how should I manage third party dependencies?» is with as few third-party dependencies as possible.

I am most compelled by the following condition:

Can I understand the code base enough that I’m comfortable patching/contributing to it?

patch-2 u

It is a somewhat counter-intuitive point. You’d think one reason to use someone else’s code is that they solve a problem above your pay-grade.

But it makes a whole lot of sense. What happens when something breaks? Can you wait for the maintainer of the dependency to fix the problem?

What do you think?

Promises Save The Day

Unfortunately Parse is closing down in 2017, but we have found a great and actually local (to us) service: AppStax.

In the past few days we’ve experienced a (possible belated) revelation about the promise-paradigm of programming, which may be familiar to you if you’re into jQuery.

Until now, we hadn’t really been able to realize what promises could do for us in our own code even though we’ve used them indirectly with Parse.com’s framework. Here’s a great blog post from Parse.com about Promises.

A promise in programming is basically a way of saying, look, I’ll do what you told me to do, and I’ll let you know in a while if I was able to or not.

The cool thing about promises is that you can chain them together. This is particularly useful if you don’t want asynchronous tasks (such as networking or IO) to be fired in parallel, but rather in a strict sequential order.

Continue reading Promises Save The Day Promises Save The Day

Unfortunately Parse is closing down in 2017, but we have found a great and actually local (to us) service: AppStax.