Posts

Simple Events in Swift

Events are useful when you need more than one delegate or event handler. Here is a simple class that can be used to manage events:




Use the uiSubscribe and uiUnsubscribe to have the Event class automatically run the event handler on the main DispatchQueue (for GUI related stuff). Here is an example of how to use them:

UIColor Extension for RGBA Hex and HSLA

Here is an extension for UIColor that I've found useful when working with Photoshop and Web designers. It allows you to specify a UIColor in RGBA hex or HSLA.

Label Sphere will be removed

I will be removing the Label Sphere from the Blogger Gadgets list on April 5th. This may break the Label Sphere on your blog. If you want to keep using the Label Sphere then read on.

If you have manually added the latest gadget using the url http://alexdioso.github.com/LabelSphere/LabelSphere.xml then you don't have to do anything.

If you have not manually added (or don't know) then you probably added the Label Sphere using the Gadgets list. To keep using the Label Sphere:

Remove the current Label Sphere on your blog.Click on "Add a Gadget".In the "Add a Gadget" window that opens:In the left column, click "Add your own".Enter the url:  http://alexdioso.github.com/LabelSphere/LabelSphere.xmlClick "Add by URL".

Displaying user@host in tmux window titles

I use tmux a lot (having switched from GNU Screen) and frequently ssh to different hosts from different tmux windows. One thing that I find helpful is knowing which host I'm ssh'd to in each tmux window. Here is a little trick for your .bash_aliases (on every host you ssh to) which will display user@host in each tmux window title:
The first part sets the terminal's window title to user@host: /working/directory
\033]2;${USER}@${HOSTNAME}: ${PWD}\007 The second part set's the current tmux window title to user@host
\033k${USER}@${HOSTNAME}\033\\

System.Workflow.* missing from Add Reference dialog

Recently, I've been working with Windows Workflow Foundation 4 a lot. I wanted to use a FreeformActivityDesigner for something but the System.Workflow.* assemblies were not listed in the Add Reference dialog. The problem was that my Solution was targeting the .NET Framework 4 Client Profile Platform Update 1 which doesn't contain those assemblies. To fix this problem just change the target to .NET Framework 4 Platform Update 1.

Edit: It looks like the FreeformActivityDesigner is not really usable in WWF 4 and that the alternative is WorkflowItemPresenter. (forum post)

Green Smoothies

Every morning I make a green smoothie, I figure since there are protein supplements why not a fruit and vegetable supplement (not a fruit/vegetable replacement or an excuse to eat junk food). Here's how I make them:

BrowserID and jQuery

I've been trying out BrowserID and for some reason binding BrowserID's navigator.id.getVerifiedEmail() to click events using jQuery never seems to work. I looked through BrowserID's sample code and found that they noticed the same thing (lines 125 - 133 as of this writing). So instead of using jQuery:

Try something like this: