Skip to content

Instantly share code, notes, and snippets.

@darkseed
darkseed / sparkogram.py
Created May 31, 2011 22:28 — forked from mnot/sparkogram.py
sparkogram.py: Sparkline histogram generator
#!/usr/bin/env python
"""
sparkogram.py - Sparkline histogram generator
This is quick and dirty. Based on Joe Gregorio's sparkline thoughts;
<http://bitworking.org/news/Sparklines_in_data_URIs_in_Python>.
"""
__license__ = """
@darkseed
darkseed / chatterbox.py
Created May 31, 2011 22:29 — forked from mnot/chatterbox.py
Chatterbox - System monitoring through social networking
#!/usr/bin/env python
"""
Chatterbox - System monitoring through Social Networking.
Chatterbox uses Twitter, IM and eventually other "social" channels to
send you information about your systems, so that you can keep in touch
with how they're performing without lots of messages in your e-mail inbox
or on your pager.
@darkseed
darkseed / bootstrap.sh
Created June 2, 2011 19:00 — forked from anonymous/bootstrap.sh
Django on Heroku with Celery and Sentry
virtualenv --no-site-packages .
source bin/activate
bin/pip install Django psycopg2 django-sentry
bin/pip freeze > requirements.txt
bin/django-admin.py startproject mysite
cat >.gitignore <<EOF
bin/
include/
lib/
EOF
@darkseed
darkseed / UIViewController+MBSensitiveInformationInScreenshotPrevention.h Prevent sensitive information from appearing in the screenshot that is automatically taken when the application transitions from the foreground to the background and vice-versa.
//
// UIViewController+MBSensitiveInformationInScreenshotPrevention.h
//
// Created by Manuel Binna on 05.05.11.
// Copyright 2011 Manuel Binna. All rights reserved.
//
@interface UIViewController (MBSensitiveInformationInScreenshotPrevention)
@darkseed
darkseed / gist:1141193
Created August 12, 2011 00:43
Set CFBundleVersion to current Git revision
/usr/libexec/PlistBuddy -c "Set CFBundleVersion `git rev-parse --short HEAD`" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
@darkseed
darkseed / multi line label.m
Created August 20, 2011 20:05 — forked from chrishulbert/multi line label.m
How to make a multiline label with dynamic text on the iphone and get the correct height
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 9999)];
myLabel.lineBreakMode = UILineBreakModeWordWrap;
myLabel.numberOfLines = 0;
myLabel.text = @"Some \n dynamic \n multiline \n text";
[myLabel sizeToFit]; // This shrinks the 9999 down to the size of the text
NSLog(@"Actual height is: %f", myLabel.frame.size.height); // Use this for spacing any further elements
[self.view addSubview:title]; // Or add it to a scroll view, or whatever...
[myLabel release];
//
// ELCCameraOverlayView.h
// ELC Technologies
//
// Created by Marc Charbonneau on 8/19/11.
// Copyright 2011 ELC Technologies. All rights reserved.
//
#import <UIKit/UIKit.h>
@darkseed
darkseed / Reachability.h
Created August 30, 2011 23:16 — forked from dhoerl/Reachability.h
Reachability (iOS) ARCified
/*
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
@darkseed
darkseed / gist:1239494
Created September 24, 2011 16:11 — forked from steipete/gist:1239338
PSIsCrappyDevice
BOOL PSIsCrappyDevice(void) {
static BOOL isCrappyDevice = YES;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
BOOL isSimulator = NO;
BOOL isIPad2 = (PSIsIpad() && [UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]);
BOOL hasRetina = [[UIScreen mainScreen] scale] > 1.f;
// enable animations on simulator
@darkseed
darkseed / NSURL+Pieces.h
Created September 26, 2011 21:23 — forked from stevestreza/NSURL+Pieces.h
A method for debugging NSURLs to find where the different pieces of your URL are
#import <Foundation/Foundation.h>
@interface NSURL (Pieces)
-(NSDictionary *)piecesDictionary;
@end