Swift: Unit Testing

I’ve recently stumbled upon severe issues, while trying to write a Unit Test, in Swift, that would access Swift Code that belongs to the main app.

Contrary to what almost everyone mentions, you should not import the Main App’s files into the Testing target.

Instead, this is what you should do:

  • Enable Defines Module in the main target.
  • Add an import at the top of the Unit Test, to make the main project visible.
  • Make sure that the classes to be tested are set to public.

Reference Here!

Fixing Violent OSX GPU Crashes

I’ve been experiencing, for months and months, quite violent OSX crashes, attributed to the GPU.

My awesome friend Dennis suggested me to try disabling Integrated <> Discrete GPU switching. And guess what? i’ve been crash free for almost two weeks.

I’m just documenting right here what has to be done, for future reference. Just uncheck this Energy Preference.
I’ve been told that the exact string for the checkmark might look different across the latest Yosemite releases, but the setting should still be lurking there:

Automatic Graphic Switching

P.s.: Again, thank you Dennis!!

San Francisco Muebles: A Website from the 90’s!

Several years ago (1999 to be precise!), i’ve started a simple website for my father’s business: San Francisco Muebles.

This is how it used to look like (thanks god for web.archive.org!)

san-francisco-muebles

Back then, iframes, simple javascript, fancy flash buttons… and some plain html was, pretty much, the gold standard for a personal (OR business) website.

Over the years, my dad’s website has evolved into many different incarnations: i’ve adopted Plain-PHP, Code Igniter, and jQuery to handle fancy transitions.

But at some point you hit a brickwall: how do i make this maintainable by anyone (not just me!) and extremely lightweight?. I do run my own Amazon Box… can i also have an extra backup layer, just in case i break my EC2 instance?

What is Jekyll?
It’s a simple tool, written in Ruby, that allows you avoid HTML duplication: if you’ve got many pages that should look the same way, you simply get to write a template, and reuse it all over.

Why Jekyll?
Jekyll is the engine behind Github Pages, and it simply caught my eye.

What is so great about having a website in Plain HTML?
Simply put, the resources required to host a Plain HTML website are extremely low.

Plus, you get to use Route53 Failover Mechanism: your website is constantly monitored. If anything goes wrong, Route53 takes over, and maps your domain elsewhere. In my case, Amazon S3 will just kick in, and serve the site.

Conclusions!
Implementing Jekyll has been a fun (and quite successful) experiment. It just took under 8 hours to do the whole thing.

However, some knowledge is still required: you need to execute a script, and upload the output to the server. Which is okay, but… there are many ways in which things can go wrong.

Bottomline: there is nothing easier, and more parent-friendly, than WordPress. Which is precisely the reason why the next incarnation will be WP based!