Skip to content

Instantly share code, notes, and snippets.

skeeet /
Created Feb 10, 2012 — forked from wearhere/
Keep your current source file open in Xcode after a run completes (a.k.a don't die in main.m)
#! /bin/sh
# On alternate invocations, this script
# saves the path of the source file currently open in Xcode
# and restores the file at that path in Xcode.
# By setting Xcode (in Behaviors) to run this script when "Run Starts"
# and when "Run Completes", you can prevent it from switching to main.m
# when a run finishes.
# See
skeeet /
Created Apr 12, 2012 — forked from MaximKeegan/
Create a RAM disk for using with XCode
# Create a RAM disk with same perms as mountpoint
# Script based on with some additions
# Usage: sudo ./ start
skeeet /
Created Apr 15, 2012 — forked from pklaus/
SSD Optimizations of Mac OS X 10.6 Operating System
# +----------------------------------------------------------------------+
# | |
# | Mount the root file system / with the option noatime |
# | |
# | By Philipp Klaus <> |
# | Tip found on <> |
# | |
# +----------------------------------------------------------------------+
skeeet / NSObject+MHChannels.h
Created Jul 17, 2012 — forked from hollance/
Communicate between objects using channels
View NSObject+MHChannels.h
#include <dispatch/dispatch.h>
typedef void (^MHChannelsBlock)(id sender, NSDictionary *dictionary);
* A "channel" is like a private NSNotificationCenter between just two objects
* (although more are possible).
* Instead of making your objects, such as two view controllers, communicate


If you're on OSX you're probably best off using Homebrew to install this stuff:

$ brew install node mongodb


View deploy.js
#! /path/to/node
var haibu = require('/path/to/haibu');
var client = new haibu.drone.Client();
process.stdin.on('data', function(data){
var package = JSON.parse(data.toString());
View UIKitLegacyDetector.m
BOOL PSPDFIsUIKitFlatMode(void) {
static BOOL isUIKitFlatMode = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) {
// If your app is running in legacy mode, tintColor will be nil - else it must be set to some color.
if (UIApplication.sharedApplication.keyWindow) {
isUIKitFlatMode = [UIApplication.sharedApplication.keyWindow performSelector:@selector(tintColor)] != nil;
# Ubuntu upstart file at /etc/init/mongodb.conf
pre-start script
mkdir -p /var/lib/mongodb/
mkdir -p /var/log/mongodb/
end script
start on runlevel [2345]
stop on runlevel [06]
View MongoDB upstart scripts for Ubuntu.
MongoDB upstart scripts for Ubuntu.
Run following commands after installing upstart scripts:
ln -s /lib/init/upstart-job /etc/init.d/mongoconf
ln -s /lib/init/upstart-job /etc/init.d/mongodb
ln -s /lib/init/upstart-job /etc/init.d/mongos
To start services use:
View mms-agent.conf
##----description "MongoDB Monitoring Service (MMS) Agent"
##Put that in /etc/init/mms-agent.conf, and you should be able to do normal things like:
##service mms-agent start
##service mms-agent stop
##service mms-agent status
##maybe you'll need
##ln -s /lib/init/upstart-job /etc/init.d/mms-agent