Grand Central Dispatch Singletons

So… what’s the recommended way (thread safety + performance) to implement a singleton?

Well.. it looks pretty much like this!
[cc lang=”objc”]
+ (instancetype)sharedInstance
{
static dispatch_once_t pred;
static Foo* bar = nil;

dispatch_once(&pred, ^{ bar = [[Foo alloc] init]; });
return bar;
}[/cc]

iPad HD

Allright… this is already everywhere. Thing is, they managed to build a display of 9.7 inches… with a 2048x1536px resolution. How much more time it’s gonna take to build Macbooks with this new kind of display ?????.

That’s the question!

OSX Terminal: Adding current folder to the title!

If you’re just like me, and have lots of Terminal tabs open, you probably end up typing ‘pwd’ all the time.

Luckily, there is an easy solution:

  1. Create a file named ‘.profile’, in your user’s home.
  2. Type the following string in there!:
    [cc lang=”bash”]export PROMPT_COMMAND=’echo -ne “\033]0;[${PWD/$HOME/~}]\007″‘[/cc]

That’s it!. You’re gonna have, from now on, the current working directory right there in the windows tab!.