Star Trek : Into Darkness

If you were looking for a new wallpaper, you’ve come to the right place. As you may know, several scenes of the new Star Trek “Into Darkness” movie were shot in the NIF… (National Ignition Facility).

The movie itself plays a twist over the original Star Trek Series, since… in the previous movie, we’ve seen an alteration in the flow of events, which led to a way different outcome.

If you haven’t gone to the cinema yet, i suggest you check it out. Seriously speaking!

 

Star Trek Into Darkness

Generating a Mac Iconset

You’ll need to create PNG assets with the following sizes and filenames:

icon_16x16.png
icon_16x16@2x.png
icon_32x32.png
icon_32x32@2x.png
icon_128x128.png
icon_128x128@2x.png
icon_256x256.png
icon_256x256@2x.png
icon_512x512.png
icon_512x512@2x.png

All of those assets should go into a folder named ‘Icon.iconset’.
Afterwards, just fire Terminal and type the following command:

iconutil -c icns

If all went well, you should have a .icns file right there!.

Reference: Apple’s Guidelines.

GIT Modules

Equivalent to SVN Externals, GIT offers a nice feature called “Modules”. Long short story, you get to link an external project, inside your own project.
What do you make out of this?. Well, suppose you’re using a 3rd party library. You can update everything with just a command line pull. No need to download and merge, by hand.

Sounds nice, right?. It’s done this way:

cd MyApp
git submodule add git://github.com/some-framework/some-framework.git Frameworks/SomeFramework

Afterwards, we need to recursively update the submodules. Which will, in turn, clone the ‘some-framework’ repository:

git submodule update --init --recursive

Removing “@2x” substring from files

If you’re reading this, probably… it’s because the Art Designers of your team just sent you a bunch of SD assets, with the @2x substring… and you don’t wanna spend the next 30 minutes cleaning that up… right?

If that’s the case, you’ve come to the right place. Fire Terminal, open the containing folder, and type the following:

find . -type f -name "*@2x*" -exec sh -c 'echo mv "$0" "${0/@2x/}"' '{}' \;


Note:
you might have just noticed that this will actually echo the replacement. That’s for safety. Validate the output, and proceed removing the ‘echo’ command call.

Waiting until two async blocks are executed (Version #2)

This is a nice variant to this other post. It gives you… way too much flexibility!

dispatch_group_t group = dispatch_group_create();

dispatch_group_enter(group);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {
  NSLog(@"Block1");
  [NSThread sleepForTimeInterval:5.0];
  dispatch_group_leave(group);
  NSLog(@"Block1 End");
});

dispatch_group_enter(group);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {
  NSLog(@"Block2");
  [NSThread sleepForTimeInterval:8.0];
  dispatch_group_leave(group);
  NSLog(@"Block2 End");
});

dispatch_group_notify(group, dispatch_get_main_queue(), ^ {
  NSLog(@"Group Notify Block3 :: %d", [NSThread isMainThread]);
});