Thursday, September 11, 2014

Evernote Links, Old Style

Well, Evernote changed the way they do links. The problem with the https:// links, instead of the older evernote:/// links, is that they require an active Internet connection. And then you have to be logged into your account, etc. And then... they don't work on iOS.

I need this all to be great for Workflowy, so here's a rough Ruby script to handle the issue for OSX.

evernote-links, Ruby Script: Set to Executable!

evernote-links, Applescript for Spark

Use it with Spark to map this to a keystroke. Use an Applescript to launch the Ruby script like this (pointing to wherever you put evernote-links):

Saturday, July 26, 2014

Finally Used My NSNumber Category

I have a category waiting for some classes, and for some reason I had one called NSNumber+Util which had no methods in it. Here's my first! Format a number as 0.000, following international rules!

Tuesday, July 22, 2014

Localizing Nibs Without Creating More Nibs

I have nibs, not Storyboards, and they don't localize well. There is no way that I'm going to maintain multiple NIBs just because I have multiple languages.

Here's a solution I cooked up. Don't localize the nibs at all. Instead, just add a localizationKey property to each element in the NIB that you need to localize, like this:


Then you need the backing categories.

Tuesday, April 15, 2014

How to Move a Git Submodule

I was in Git hell for more than a day. Word to the wise: copy the entire directory before doing anything crazy using your OS. Even reflog cannot get you back when your submodules get screwed up.

Anyway, here's how to move a git submodule. Hint: you cannot do it with git mv.


Thursday, March 6, 2014

Pragma Mark Scheme for iOS Dev


If you want to be like all the smart people you read about on the Internet, you'll keep your files really well-organized. If you have such long files that you need to use pragma marks (which some people, including Jeff Atwood, I recall, think means that your files are too long) you have a basic organizational problem. Now the solution to this is, of course, "bust the file up into sections and stick to those." But what would those sections be? So I'm usually going by functionality, but then I inevitably lose it and end up with no organization at all, or (worse) using it in half the file.

The reason that I failed is that I cannot use a scheme that requires you to know what each method does. That's very time-consuming and, in a sense, redundant with the messages you see passed in the code.

So here's my new scheme, which is very easy to use because it doesn't require you to think. I've been trying this for a while and it's great.

#pragma mark - class methods
#pragma mark - initializers, dealloc, and lifecycle methods
// like didMoveToSuperview
#pragma mark - property accessors
#pragma mark - public overrides
#pragma mark - public property accessor overrides
#pragma mark - public methods
#pragma mark - protocol A methods
#pragma mark - protocol B methods
#pragma mark - dependent-object lifecycle
// like viewDidLoad, viewDidAppear, etc., NOT like hideView
#pragma mark - Methods not in public interface
#pragma mark - Not Implemented

Monday, December 17, 2012

Date and Timestamp Trigger in OSX

I'm so proud that I finally just took on Applescript a bit and did a date script. It was a hassle, but I even did a method (whoot!). So you put this in with the script editor and then save it to a .scpt file (default).

2013-10-02 01:35
Now using Spark (link). Awesome.

Sunday, December 9, 2012

Occasional Markdown Plugin

I'm not too into PHP now, nor was I ever into programming for Wordpress. However, I was not happy with the Markdown options available.

I want this:

<pre class="markdown">
**Markdown here!**
</pre>

**this is not markdown**

<pre class="markdown">
**More markdown here!**
</pre>

To come out like this:

Markdown here!

**this is not markdown**

More markdown here!

So I made a plugin in Wordpress to do that. Of course, all the work was already done. Also, I have no idea if this is safe or not for your Wordpress installation. I haven't tested with comments, especially, which are user input, so be careful.

Anyway, check it out in my Github fork.