Archive for the ‘github’ Category

Announcing tmdiff

For all I know this already exists and I just was unable to google it up. Assuming it doesn’t, tmdiff allows you to perform a command line diff on a text file against a time machine version.

Repo: https://github.com/erica/tmdiff

Usage:

Usage: tmdiff (--list)
       tmdiff [offset: 1] path

The list option just lists the dates for the backups in reverse chronological order. Supply a path to diff, e.g.

tmdiff Style600-Control\ Flow.md

It defaults to using the “but last” backup offset of 1. If you want to use the most recent backup, use 0 instead, or any number moving further back in time as the value increases:

tmdiff 0 Style600-Control\ Flow.md
tmdiff 3 Style600-Control\ Flow.md

I hope this is handy for someone out there on the opposite side of the Intertube, especially since version control is baked into stuff like TextEdit. Do let me know if you use it.

Update: See also github.com/erica/tmls and github.com/erica/tmcp. The former runs ls, complete with arguments. The latter performs a nondestructive copy with the Time Machine date appended.

How to curl raw content from gists

In my most recent post about installing Ubuntu/Swift, I glancingly referred in a screenshot to pulling swift source from a github gist. I thought it was useful enough a tip to pull out to its own post.

Say you have a gist, for example: this one, which is located at gist.github.com/erica/4d31fed94f3668342623. I threw this sample together to help some Linux-ers work with incomplete Foundation and Standard Library implementations on Ubuntu.

If you grab this link’s content from the terminal command-line using curl, you’ll end up with the page’s HTML source, which is pretty much not what you want to compile:

Screen Shot 2015-12-20 at 11.20.36 AM

Instead, replace gist.github.com with gist.githubusercontent.com and append /raw to the url:

https://gist.githubusercontent.com/erica/4d31fed94f3668342623/raw

This adjusted URL bypasses the HTML page contents and accesses the raw text stored within the gist. Just redirect with > into a Swift file and you’re ready to compile.

Screen Shot 2015-12-20 at 11.24.02 AM

I hope this tip helps minimize the misery of sharing code with Ubuntians.

Funpaths repository at Github

iOS Simulator Screen shot Mar 16, 2013 2.36.47 PM

If anyone is interested in a few fun shapes, I put up some UIBezierPaths at github. These are courtesy of PaintCode, through SVG import. I discovered that I could build a shape in Photoshop, export it to Illustrator, and save to SVG.

None of the art is mine, and the shapes seem to be freely licensed. The cute stuff is by ~hikaridrops on Deviant Art.

In related news, this UIBezierPath is not a dogcow:

iOS Simulator Screen shot Mar 15, 2013 9.47.15 PM

but this is:

iOS Simulator Screen shot Mar 15, 2013 9.48.33 PM

For details, see Macintosh Technical Note #31.