Links April 2013: MAS Receipts, Django, Node ⇆ Obj-c, Mac Window Managers, Youtube Downloader

Drop-In Mac App Store Receipt Verification

https://github.com/ivira/NPReceiptVerification

Oscar: ecommerce framework for Django

Oscar was built from the ground up to make very few assumptions about your project, allowing virtually any part of the framework to be extended and customised. In this way, complex business rules can be captured in an elegant and cohesive way.

http://oscarcommerce.com

NodObjC

The NodeJS ⇆ Objective-C bridge

https://github.com/TooTallNate/NodObjC

ShiftIt

Managing window size and position in OSX

https://github.com/fikovnik/ShiftIt

youtube-dl

small command-line program to download videos from YouTube.com and a few more sites

http://rg3.github.io/youtube-dl/

Comments

NSLogger Colors With Regular Expressions

I wrote a patch for NSLogger to add colors to log rows using regular expressions.

Continue reading
Comments

Git Branch on Bash Prompt and Terminal Title Bar

When you work in several project versions, each one with multiple branches, it’s easy to get lost and make mistakes because you are working in the wrong branch.

Continue reading
Comments

Instruments From the Command Line

Launch iOS UI automation script in the simulator:

instruments -D <profiler-output-directory>
            -t <template>
            <path-to-app-bundle>
            -e UIARESULTSPATH <automation-script-output>
            -e UIASCRIPT <automation-script>

The <path-to-app-bundle> must point to a i386 build of the app.

And in the device:

instruments -D <profiler-output-directory>
            -t <template>
            -w <device-udid> 
            TheApp 
            -e UIARESULTSPATH <automation-script-output>
            -e UIASCRIPT <automation-script>

In the device you need to install the app yourself (just launch profile from Xcode) and provide the app name to instruments (without .app suffix).

In both cases the <template> is the path to Automation.tracetemplate. In my current installation is located at /Applications/Xcode.app/Contents/Developer/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate.

If necessary you can set additional environment variables with -e <variable-name> <variable-value>.

Also, man instruments.

Comments

Git Diff UTF-16 Strings Files

In git UTF-16 files are treated as binary by default. This make diff and merge operations harder.

This is my setup to deal with iOS apps localization files:

.git/config

[diff "l10n"]
    textconv = "iconv -f utf-16 -t utf-8"

.gitattributes

*.strings utf16 diff=l10n

I use a custom key binding in tig to run a quick diff:

.tigrc

bind status  d !git diff HEAD %(file)

I just need to run tig status, navigate to the file and press d.

git
Comments

Contacts in Mutt

Query OS X addressbook

Install Little Brother Database, aka lbdb.

Regular formula was broken at the time of this writing, I used this:

brew install https://raw.github.com/tgray/homebrew/master/Library/Formula/lbdb.rb

Then customize ~/.lbdbrc to query mac contacts:

METHODS="m_muttalias m_osx_addressbook"

You may need to adjust MUTT_DIRECTORY and MUTTALIAS_FILES.

Finally enable queries in mutt:

set query_command="/usr/local/bin/lbdbq '%s'"

Press Ctrl-t to query the contacts database when prompted for an email address.

Autocomplete aliases

In addition of system contacts you can keep a file with most used addresses for easy autocompletion and quick distribution lists.

Specify your aliases file in .muttrc:

source ~/.mutt/aliases
set alias_file=~/.mutt/aliases

Press TAB to complete an address using aliases on email prompts.

Autocomplete headers in vim message composition

Install mutt-aliases.vim to complete aliases inside vim. Original work by Lu Guanqun.

Source the script in your .vimrc. In any email header type a partial alias and press Ctrl-x Ctrl-u to trigger autocomplete.

Comments

Links February 2013: Node, Ssd in OS X, Disk Inventory X

Category list plugin for octopress

Easy output tag cloud and category list.

https://github.com/alswl/octopress-category-list

Monitor directories and files in Node

Utilities for watching file trees in node.js

https://github.com/mikeal/watch

It looks like this:

1
2
3
4
5
6
7
8
9
10
11
    watch.createMonitor('/path/to/root/dir', function (monitor) {
        monitor.on("created", function (f, stat) {
          ...
        });
        monitor.on("changed", function (f, curr, prev) {
          ...
        });
        monitor.on("removed", function (f, stat) {
          ...
        });
    }

Run a node script forever

A simple CLI tool for ensuring that a given script runs continuously (i.e. forever)

https://github.com/nodejitsu/forever

A must have if you have long running node scripts.

% forever start <your-script>
% forever list
% forever stop <your-script>

Pinax

By integrating numerous reusable Django apps and providing starter projects and infrastructure tools, Pinax takes care of the things that many sites have in common so you can focus on what makes your site different.

http://pinaxproject.com

Optimizing MacOS X Lion for SSD

http://blog.alutam.com/2012/04/01/optimizing-macos-x-lion-for-ssd/

I was looking for a way to disable hibernation in laptops:

sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage

Disk Inventory X

If you’ve ever wondered where all your disk space has gone, Disk Inventory X will help you to answer this question.

http://www.derlien.com/index.html

Wincent Strings Utility

Merge localizable strings files.

http://www.wincent.com/a/products/wincent-strings-util/

Comments

Links January 2013: BetterTouchTool, ClickToFlash, SlimBatteryMonitor

BetterTouchTool app

…configure many gestures for your Magic Mouse, Macbook Trackpad and Magic Trackpad

http://www.boastr.de

I use it to map 3-finger swipes to Xcode debug shortcuts.

ClickToFlash

http://hoyois.github.com/safariextensions/clicktoplugin/

Prevent flash plug-in (and others) from loading automatically.

SlimBatteryMonitor

a replacement power gauge for Apple’s Mac OS X that tracks both laptop batteries and many UPS batteries

http://www.orange-carb.org/SBM/

Youtube with HTML5

http://www.youtube.com/html5

MacRumors Apple Notebook Battery FAQ

http://forums.macrumors.com/showpost.php?p=9875442&postcount=23

From 2010 but worth a reading.

Comments

Links December 2012: Better Ls

A better ls for Mac OS X

http://hocuspokus.net

Nice colour scheme for your ~/.dir_colors.

Handy oneliner:

curl -s "http://www.codigoalienigena.com/Download/dir_colors.txt" > ~/.dir_colors
Comments

Links October 2012: Javascript Dates, Node, Vows

Console colors in NodeJS

http://roguejs.com/2011-11-30/console-colors-in-node-js/

How to add ANSI colors to your console output:

var red   = '\033[31m',
    blue  = '\033[34m',
    reset = '\033[0m';
console.log(red + '* Error' + reset + ' Reason: ' + blue + 'Internet is down!' + reset);

There a few node modules about the subject: cli-color, colorize, sty.

Moment JS

http://momentjs.com

Great date manipulation library for javascript. Works with node.

cli

https://github.com/chriso/cli

“A toolkit for rapidly building command line apps”.

appledoc

http://gentlebytes.com/appledoc/

“command line tool that helps Objective-C developers generate Apple-like source code documentation from specially formatted source code comments”

Vows

http://vowsjs.org

“Asynchronous behaviour driven development for Node.”

Comments