macOS Quick Look plugins for JavaScript, Markdown, JSON, …

quicklookjson

The repository sindresorhus/quick-look-plugins has gathered a collection of some handy macOS Quick Look Plugins. Pictured above is a quick look preview of a JSON file.

Installation of the plugins is possible via Homebrew.

sindresorhus/quick-look-plugins

(via Freek, quite some time ago)

Mission Control – Remote Config Utility for iOS, OSX, …

swift

Have you ever wished you could change some config parameter for your app without deploying a new version? Of course you have! Wouldn’t it be great if you had whole config for your app in the cloud and change it as you see fit? Of course it would! Well, go ahead, just put some config somewhere in the cloud and MissionControl will take care of the rest for you.

This code will get you started:

// Local Config 
let config: [String : AnyObject] = [
    "Ready" : true,
    "LaunchForce" : 0.21
]

// Remote Config Endpoint
// Format the config as a JSON payload
let remoteURL = NSURL(string: "http://appculture.com/mission-control")!

// Initialize Misson Control.
// Settings from the remote config will overwrite the local config
MissionControl.launch(localConfig: config, remoteConfigURL: remoteURL)

// Get config values using helper accessors
let ready = ConfigBool("Ready", fallback: false)
let numberOfSeconds = ConfigInt("CountdownDuration", fallback: 10)
let launchForce = ConfigDouble("LaunchForce", fallback: 0.5)
let color = ConfigString("ReadyColor", fallback: "#7ED321")

Mission Control →

At work we build things like in all of our apps. Last year – for a Hybrid App named “De Allesweter” – we did exactly the same thing using JavaScript. That’s how we roll.

Implementing this yourself is fairly easy: fetch() the remote config, and merge it with your local one using Object.assign().

Drobo vs OS X Mavericks

drobo_logo_lg

After upgrading to Mavericks your Drobo might not show up in Finder (here it did just fine, using a Drobo FS800 (aka 2nd gen Drobo) connected over Firewire). If that happens, do either one of these to get your Drobo visible in Finder again:

  • Unmount the Drobo from Disk Utility (where it by magic will appear!?) and mount it again by reconnecting it to your Mac.
  • Unplug and put back the power to your Drobo, after which it will restart.

One of those should do the trick in case your Drobo might be missing.

OS X hardlink

UPDATE 2013.02.09: Via the comments I’ve come to know that it is possible with ln after all as long as you don’t combine a tilde (˜) and quotes in the source path (which I did because some of my folders have spaces in their name). Just escape any spaces with a \ and the tilde will resolve fine. No need for one to install hardlink. Thanks @mathias!

A simple command-line utility that implements directory hardlinks on Mac OS X

Because OS X’ built-in ln is crippled. Install via:

git clone git://github.com/selkhateeb/hardlink.git
make
sudo make install

Usage

# create hardlink
hardlink source destination

#remove hardlink
hardlink -u destination

Thanks to this one I can now cd into ~/Kaho/ws2 instead of ~/Dropbox/Kaho/Lesactiviteiten/WS2 - Serverside/2012-2013 🙂

hardlink →

Autocomplete git branch name

Turns out it’s possible to enable autocompletion of git branch names when working on the command line. The script can be automatically installed on OS X using these commands:

$ curl -G https://raw.github.com/git/git/master/contrib/completion/git-completion.bash > ~/.git-completion.sh
$ echo 'source ~/.git-completion.sh' >> ~/.bash_profile

Don’t forget to re-open any already open Terminal windows.

(via @decthomas)

UPDATE: I’ve been notified that this script also autocompletes names of remotes and the like 🙂

Napkin for Mac

Napkin is the ultimate tool for concise visual communication. Painlessly annotate images or create diagrams and share the results quickly.

Not only does it and the results look good, it also some contains some interesting user interactions.

Napkin →

Face Detection on OS X and iOS

Recently I realized that Apple added support for face detection in OS X Lion and iOS 5. Apple’s face detection is exposed through Core Image, the super-useful image manipulation library. Two classes are important: CIDetector and CIFeature (along with its subclass, CIFaceFeature). With a little experimenting one night, I was able to get a sample app detecting faces within a static image in about 10 lines of code:

// Create the image
CIImage *image = [CIImage imageWithContentsOfURL:[NSURL fileURLWithPath:@"Photo.jpg"]];
 
// Create the face detector
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:CIDetectorAccuracyHigh, CIDetectorAccuracy, nil];
 
CIDetector *faceDetector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:options];
 
// Detect the faces
NSArray *faces = [faceDetector featuresInImage:image];
 
NSLog(@"%@", faces);

Comes with a more extended example

Panic Blog: Fun with Face Detection →

Zero-config development with Apache’s VirtualDocumentRoot and xip.io

# Use name-based virtual hosting.
NameVirtualHost *:80
UseCanonicalName Off
 
# ~/Sites/ vhost configuration - sends foo.bar.dev to ~/Sites/bar/foo
<VirtualHost *:80>
    VirtualDocumentRoot /Users/dave/Sites/%2/%1
 
    <Directory "/Users/dave/Sites">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

What that VirtualDocumentRoot does is map the above company and project to the %2 and %1 variables, respectively. So whenever I surf to http://foo.bar.dev, I end up in ~/Sites/bar/foo.

Dave’s a clever man.

Zero-config development with Apache’s VirtualDocumentRoot and xip.io →