Skip to content

Instantly share code, notes, and snippets.

struct NetworkInterfaceFlags : OptionSetType {
let rawValue: UInt
static let None = NetworkInterfaceFlags(rawValue: 0)
static let Up = NetworkInterfaceFlags(rawValue: 1 << 0)
static let Broadcast = NetworkInterfaceFlags(rawValue: 1 << 1)
static let Debug = NetworkInterfaceFlags(rawValue: 1 << 2)
static let Loopback = NetworkInterfaceFlags(rawValue: 1 << 3)
static let PointToPoint = NetworkInterfaceFlags(rawValue: 1 << 4)
static let Smart = NetworkInterfaceFlags(rawValue: 1 << 5)
static let Running = NetworkInterfaceFlags(rawValue: 1 << 6)
@codecaffeine
codecaffeine / randimg.rb
Last active February 21, 2024 22:22
Random Image Generator (imagemagick + ruby)
#!/usr/bin/env ruby
# Script to generate random images. Based on http://www.imagemagick.org/Usage/canvas/#random_blur
require 'optparse'
options = {}
optparse = OptionParser.new do |opts|
@codecaffeine
codecaffeine / LetsMove.podspec
Last active January 3, 2016 15:29
Fixed LetsMove.podspec
Pod::Spec.new do |s|
s.name = "LetsMove"
s.version = "1.9"
s.summary = "Move a running Mac application to the /Applications directory."
s.description = <<-DESC
Move a running Mac application to the /Applications directory.
DESC
s.homepage = "https://github.com/potionfactory/LetsMove/"
s.license = 'Public Domain'
@codecaffeine
codecaffeine / socket.IO.podspec
Created October 24, 2013 19:37
Fixed podspec for socket.io
Pod::Spec.new do |s|
s.name = "socket.IO"
s.version = "0.4.0.1"
s.summary = "socket.io v0.7.2+ for iOS devices."
s.description = <<-DESC
Interface to communicate between Objective C and Socket.IO with the help of websockets. It's based on fpotter's socketio-cocoa and uses other libraries/classes like SocketRocket, json-framework (optional) and jsonkit (optional).
DESC
s.homepage = "https://github.com/pkyeck/socket.IO-objc"
s.license = 'MIT'
@codecaffeine
codecaffeine / gist:5333319
Created April 8, 2013 00:35
RACable(textView.text) vs. matchedTextView.rac_textSignal
@interface CAFMatchedTextViewController ()
@property (strong, nonatomic) IBOutlet UITextView *matchedTextView;
@end
@implementation CAFMatchedTextViewController {
- (void)viewDidLoad {
[super viewDidLoad];
[self.matchedTextView.rac_textSignal subscribeNext:^(NSString *string) {
@codecaffeine
codecaffeine / gist:5297755
Last active December 15, 2015 17:39
FamilyNames and FontNames in iOS 6 (Plus SourceCodePro)

Thonburi

  • Thonburi-Bold
  • Thonburi

Snell Roundhand

  • SnellRoundhand-Bold
  • SnellRoundhand-Black
  • SnellRoundhand

Academy Engraved LET

@codecaffeine
codecaffeine / TouchJSON.podspec
Created February 21, 2013 16:27
TouchJSON Podspec for 1.1-NonARC
Pod::Spec.new do |s|
s.name = 'TouchJSON'
s.version = '1.1'
s.license = 'Simplified BSD License'
s.summary = 'TouchJSON is an Objective-C based parser and generator for JSON encoded data.'
s.homepage = 'https://github.com/TouchCode/TouchJSON'
s.author = { 'Jonathan Wight' => 'schwa@touchcode.com' }
s.source = { :git => 'https://github.com/TouchCode/TouchJSON.git', :tag => '1.1-NonARC' }
s.source_files = 'Source/**/*.{h,m}'
s.framework = 'Foundation'
@codecaffeine
codecaffeine / NSTextCheckingResult type
Created August 30, 2012 11:46
Print NSTextCheckingResult type quick and dirty
if (result.resultType == NSTextCheckingTypeOrthography) {
NSLog(@"resultType: %@", );
} else if (result.resultType == NSTextCheckingTypeSpelling) {
NSLog(@"resultType: %@", );
} else if (result.resultType == NSTextCheckingTypeGrammar) {
NSLog(@"resultType: %@", );
} else if (result.resultType == NSTextCheckingTypeDate) {
NSLog(@"resultType: %@", );
} else if (result.resultType == NSTextCheckingTypeAddress) {
NSLog(@"resultType: %@", );
@codecaffeine
codecaffeine / ImageRepresentationMethod.m
Created February 9, 2012 23:40
Get a UIImage from a UIView
#import <QuartzCore/QuartzCore.h>
- (UIImage *)caf_imageRepresentation
{
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0.0);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
@codecaffeine
codecaffeine / gist:1623166
Created January 16, 2012 21:38
Automator Service for Symbolicating the Current Selected File(s)
for f in "$@"
do
/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash -o "$f" "$f"
done