Skip to content

Instantly share code, notes, and snippets.

View gist:40246
# NAME: authinabox
# VERSION: 1.01 (Dec 27, 2008)
# AUTHOR: Peter Cooper [ github:peterc twitter:peterc ]
# DESCRIPTION: An "all in one" Sinatra library containing a User model and authentication
# system for both session-based logins OR HTTP Basic auth (for APIs, etc).
# This is an "all in one" system so you will probably need to heavily tailor
# it to your own ideas, but it will work "out of the box" as-is.
# COMPATIBILITY: - Tested on 0.3.2 AND the latest rtomayko Hoboken build! (recommended for the latter though)
# - NEEDS DataMapper!
# - Less work needed if you use initializer library --
Script to convert a Xcode3 Color theme into a Xcode4 one.
bash# python Twilight.xcolortheme
It will write a new file: Twilight.dvtcolortheme into the same folder as the script is residing in.
import plistlib,sys
""" Define boilerplate of the color theme """
defaultConfig = {
View gist:785500
# ignore all files in an xcodeproj except for the project itself
# unfortunately, this doesn't handle projects in nested dirs. Repeat this pattern as deep as you want
0xced / UIDevice+HostUUID.h
Created Apr 15, 2012
Alternative iOS device unique identifier
View UIDevice+HostUUID.h
#import <UIKit/UIKit.h>
@interface UIDevice (HostUUID)
- (NSString *) xcd_uniqueIdentifier;
MicahChalmer / .htaccess
Last active May 1, 2016
Scripts to set up Ruby 1.9.3 on a DreamHost shared hosting account via rbenv and ruby-build, and run a Rack app with it via FastCGI.
View .htaccess
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
ccgus / gist:4961749
Created Feb 15, 2013
replacing NSImage reps
View gist:4961749
NSImage *iRep = [NSImage imageNamed:[fileName stringByDeletingPathExtension]];
if (iRep) {
NSImage *ni = [[NSImage alloc] initByReferencingFile:output];
for (NSImageRep *r in [[iRep representations] copy]) {
[iRep removeRepresentation:r];
svoisen / Of Mice and Men
Created Mar 21, 2013
Information on low-level scrolling events on Mac OS X
View Of Mice and Men
From the WebKit documentation at:
// Of Mice and Men
// ---------------
// There are three types of scroll data available on a scroll wheel CGEvent.
// Apple's documentation ([1]) is rather vague in their differences, and not
// terribly helpful in deciding which to use. This is what's really going on.
marcoarment / feed-subscribers.php
Created Jul 10, 2013
Better RSS-subscribers script for the post-Google-Reader world.
View feed-subscribers.php
<?php /* With apologies to Dr. Drang and John Siracusa.
By Marco Arment.
Released into the public domain with no warranties and no restrictions.
Usage: Pipe an Apache access log into stdin, e.g.:
php -f feed-subscribers.php < /var/log/httpd/access_log
erichurst / US Zip Codes from 2013 Government Data
Created Dec 9, 2013
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source:
View US Zip Codes from 2013 Government Data
This file has been truncated, but you can view the full file.
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
kluivers / gist:9808519
Created Mar 27, 2014
Responder forwarding
View gist:9808519
@implementation UIResponder (ResponderForwarding)
- (BOOL) tryToPerformAction:(SEL)action withObject:(id)object
@implementation UIResponder (ResponderForwarding)
- (BOOL) tryToPerformAction:(SEL)action withObject:(id)object
if (!action) {
return NO;