Skip to content

Instantly share code, notes, and snippets.

View MSch's full-sized avatar

Martin Schürrer MSch

View GitHub Profile
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@MSch
MSch / SingletonInitializer.m
Created April 26, 2011 22:56 — forked from AlanQuatermain/SingletonInitializer.m
An implementation of a Singleton accesAn implementation of a Singleton accessor routine. Removes the (one if-statement) overhead of calling dispatch_once after the first time by method swizzling sharedInstance for a method without dispatch_once
#import <dispatch/dispatch.h>
#import <objc/runtime.h>
@implementation MySingleton
static MySingleton * __singleton = nil;
+ (MySingleton *) sharedInstance_accessor
{
return ( __singleton );
require 'rubygems'
require 'sinatra'
require 'dm-core'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'sqlite3::memory:')
# Don't use this in production code! Extending lots of objects during runtime
# will have a negative impact on performance/memory because ruby clears out
# the method cache.