Git ‘cherry-pick’ individual file

Today the situation came up where I wanted the latest of a file in another branch. But only that file. Didn’t want to merge and reject so that get’s rid of cherrypick and merge as options.

Luckily there is a way to do this just using the checkout command.

git checkout feature/meow Source/Cat.cs

 

Sauce : http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/

Get a patch file from a github commit

Writing this mostly so I don’t forget.

Let’s say you want a patch file of a particular commit, for example: https://github.com/bardic/StalkCoin/commit/8789de6bd0db33fb6622f4a25438b74d6b9317ec

Append .patch to the end of that ( https://github.com/bardic/StalkCoin/commit/8789de6bd0db33fb6622f4a25438b74d6b9317ec.patch ) and you have yourself a patch file!

Source: http://chem-bla-ics.blogspot.ca/2011/01/github-tip-download-commits-as-patches.html

Grouping signals in StrangeIoC

Recently I have started relearning Unity3d and because I very much enjoy DI and IoC I’m also relearning StrangeIoC. Since I’ve last looked at Strange, Signals have been added. This makes me very happy being an old AS3 dev that <3’d Robotlegs and AS3Signals.

Anywho, one “problem” with signals, that existed in flash as well, is that each signal is a class. The idea of making a 5 line class for each signal I want to dispatch irks me. My solution is an ugly one but I liked it when doing flash and so far like it here as well.

namespace ca.openbracket.signals{
    public class StartSignal:Signal{}
    public class TestSignal:Signal{}
}

What I like about this approach is that I can group my related signals into a single file and see them all.  The two big drawbacks are searching for a signal can be difficult if you aren’t accustomed to this and you don’t get more granulated version control details.

Is this worth it? I have no idea. But it makes me happy.

Font ascender’s cut off for custom fonts on ios7

Just look at that title. What a stupid bug.

Anyways, in one of the apps I work on we were seeing on ios7 that a custom bold font was clipping the ascenders on all uppercase characters. After some googling I found that it was an ios bug.  I luckily found a nicer way to correct the issue than having to increase the height of each textfield by 6 pixels and offsetting it’s ypos.

This post describes using the OSX Font Tool to pull the measurements from the font and allow you to edit them. So by setting the lineGap to 0 (the ios bug is that lineGap is ignored :/ ) and adding that amount to ascender you can fix the problem. I haven’t had design sign off on this yet so I’m not sure if it’s perfect but it works and looks pretty good to me

 

::MARCH 31st EDIT::

So the artist and I looked at the font change and it doesn’t work for our needs. Yes, it fixes the issue, but our text is not not in the right position and since only one field if effected we chose to just increase the height of the field and change its offset.

Getting started with HaxeFlixel

With Haxe gaining so much popularity, flash work declining and my want to make 2d games with a language I’m already fairly familiar with that I can publish to multiple platforms, I’ve decided that Haxe is the right move. With that decision I had to pick a game engine and it was really between Flambe or HaxeFlixel.

Since I don’t care about a html5 target and I feel slightly more comfortable in the HaxeFlixel API, I have decided to use it.

Getting started is actually pretty easy but there were a few points that tripped me up slightly. The official documentation for installation is actually spot on. Check it out here.

Once installed, you need some more of editor/IDE. Since I’m developing on a Mac, I have pretty limited options. Since the IntelliJ plugin is wonky at best, I’ve gone with Sublime Text.  When setting up Sublime I was easily able to set up the plugin following the instructions but could not for the life of me get it to actually get it to highlight or code complete.

The issue was the instructions I was following didn’t point out the need to set up some path variables.  The easiest way to do this is to add these variables to your .bashrc

In your home directory (~/) run nano .bashrc . If you have this file it’ll open it, if not it will create it. Then add this:

export haxe_path="/usr/bin/haxe"
export HAXE_LIBRARY_PATH="/usr/local/lib/haxe/std:."

Exit and save.

Once you have all your libs set up for HaxeFlixel you want to add a symlink to the subl command in Sublime. This will allow HaxeFlixel to open the project for you when creating new projects.  There are official instructions on this but it didn’t work for me.  My path was slightly different :

ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin/subl

And that there covers the initial setup issues I encountered. I’ll likely post more findings as I learn more of HaxeFlixel. I actually never used Flixel before, but have several years of Flash development behind so most of my findings will likely be differences from Flash to Haxe .

StalkCoin

Lately I’ve been doing a lot of Objective-C development for mobile and also took interest in AltCoins (BitCoin, LiteCoin, etc). After google’ing around for about 15 seconds I couldn’t find a menu ticker to show me the current prices of the coins I’m interested in.

So I said screw it and made one.  This was my first attempt at making a native desktop app.

If you’ve ever have done mobile ObjectiveC dev, there is very little difference. The biggest difference is the change in class prefix; UI on iOS, NS on OSX.

Other then that, it’s business as usual. Installed my libs through cocoapods, and  using xibs for layouts/popups.

The most interesting challenge I’ve encountered so far is not directly related to the app, but a language oddity. Coming from AS3 and C#, I use a lot of events. Events in ObjC, Notifications, are not nice. At least this is what my reading has told me. They message all living objects which can be heavy. StalkCoin though is not a large app, but I don’t like the idea of using them.

An alternative is to use delegates or blocks.  And I use this approach a lot in my other apps, but it still doesn’t sit right with me. What I really want is something like as3-signals.  Or C#Messenger. Perhaps I should bite the bullet and port one of this libraries to ObjectiveC.

Any who, it’s available for download now! You can grab it from the here: http://www.openbracket.ca/stalkcoin/

As I work on it I’ll delve more into what I like/dislike and whatever else is interesting.

AppCode

If you have ever done flash development, you quickly realize that the Flash IDE is the worse play to actually write code. It’s down right awful. So you look at other IDEs; FlashDevelop, FlashBuilder, FDT, IntelliJ. If you are like me you would likely have settled on IntelliJ. The team at Jetbrains just get it. The tools is just brilliant from it’s svn/git integration to it colours to it’s epic refactor tools.

Well when I started doing more ObjectiveC development, I started to encounter issues with Xcode that bothered me greatly. Refactor was poor, version control integration was poor, the way it handled opening files frustrated me. Luckily, the Jetbrains team had developed an app that fixes all of these issues for me: AppCode.

Now AppCode isn’t perfect. It lacks the ability to handle xibs and xcdatamodels as well has some of the finer project settings (They actually may be there but if they are they are incredibly difficult to find and access). But despite these short comings this IDE is the bee’s knee’s. Fast, pretty, great refactor,  great app analysis and many more.  For me the price of having to open Xcode once or twice a day is completely worth the benefits that AppCode provides. Mind you, I  work on apps/games that don’t rely heavily on using xibs so I almost never have the need to open Xcode for that. But on the few projects I’ve done that heavily use xibs, I open Xcode, lay them out, hook up my outlets and then switch over to AppCode for everything else.

So if you develop ObjC and haven’t tried this I strongly suggest you download the trial and give it a goal. You’ll likely be hooked before the 30 days are up.

DISCLAIMER: I have no association with Jetbrains. I just love their software and think you should too

StrangeIoC

Moving from Actionscript to Unity one of the things I missed the most was a framework like Robotlegs that has been the base for any as3 project I’ve done in the last year or two. Recently a buddy at work discovered StrangeIoC and I must say, it is awesome.  If you haven’t used and IoC framework before you should really check it out.

Anyways, if you are familiar with Robotlegs then this is definitely for you since the API is very similar. So similar in fact that a guide for RL users exists!

Give it a shot. It’s bloody awesome

XCode shortcuts

Since I’ve been doing a bit of ObjectiveC lately I’ve been stuck in XCode and coming from better IDEs (IntelliJ; and yes I know about AppCode but I don’t have a license) I’ve become very accustomed to a certain workflow that I’ve had difficulty reproducing.

But recently I took some time and found a few of the shortcuts that I *need* which decrease my reliance on my mouse

 

  • Quick Open: cmd+shift+o
  • Jump to: cmd+ctrl+click
  • Jump to in new tab: cmd+alt+click
  • Switch tabs: cmd+shift+ { or }
  • Global Find: cmd+shift+f

 

Still haven’t found a shortcut for quick refactoring so if you know of one please share.

 

NME error – Missing super constructor call

So since my memory sucks and I likely will forget this one, I’m going to put it here. It’s an easy enough fix and a stupid error on my part but it took me a good 30 minutes to figure it out.

On compile after creating an empty project I received this error

Source/Main.hx:15: lines 15-35 : Missing super constructor call

The solution is to add super() to your new function for your class.