Skip to content

Instantly share code, notes, and snippets.

@darkseed
darkseed / hubbub.py
Created February 26, 2010 16:15 — forked from Arachnid/hubbub.py
from google.appengine.api import urlfetch
from google.appengine.api import xmpp
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import xmpp_handlers
import base64
import feedparser
import logging
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//
// NSString+FileTextEncodingAttribute.h
// Adapted from http://github.com/scrod/nv/blob/master/NSString_NV.m
//
#import <Foundation/Foundation.h>
#include <sys/xattr.h>
@interface NSString (FileTextEncodingAttribute)
*.pbxproj -crlf -diff -merge
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (self.tabBarController.selectedViewController == self.navigationController)
return NO;
else
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@darkseed
darkseed / TextViewPinchToZoom
Created May 11, 2011 11:33 — forked from aral/TextViewPinchToZoom
How to use add pinch-to-zoom to a TextView
// Create a pinch gesture recognizer instance.
self.pinchGestureRecognizer = [[[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchGesture:)] autorelease];
// And add it to your text view.
[self.myTextView addGestureRecognizer:self.pinchGestureRecognizer];
// ...
- (void)pinchGesture:(UIPinchGestureRecognizer *)gestureRecognizer
{
@darkseed
darkseed / DataManager.h
Created May 21, 2011 19:54 — forked from NachoMan/DataManager.h
Core Data singleton manager class capable of being run from a static library
// DataManager.h
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
extern NSString * const DataManagerDidSaveNotification;
extern NSString * const DataManagerDidSaveFailedNotification;
@interface DataManager : NSObject {
}
@darkseed
darkseed / ec2-ssh.rb
Created May 23, 2011 19:30 — forked from qwzybug/ec2-ssh.rb
SSH into an EC2 instance by name.
#!/usr/bin/env ruby
instance_name = ARGV[0]
abort "Please specify an instance name" unless instance_name and instance_name.length > 0
instance_info, selected_instance = {}, nil
info_keymap = {2 => :ami_id, 3 => :address, 5 => :status, 6 => :keypair_name}
instances = `ec2-describe-instances`.split("\n").map{|l| l.split("\t")}
instances.each do |line|
@darkseed
darkseed / wikipedia_links.py
Created May 31, 2011 22:23 — forked from mnot/wikipedia_links.py
Pull links out of a Wikipedia XML dump, real fast.
@darkseed
darkseed / gexport.py
Created May 31, 2011 22:23 — forked from mnot/gexport.py
gexport.py - Export Google Docs to a local directory
#!/usr/bin/env python
"""\
gexport.py
Export Google Docs to a local directory.
Requires the GData Python client library:
http://code.google.com/p/gdata-python-client/
"""