This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# $ gem install CFPropertyList | |
require 'cfpropertylist' | |
path = File.expand_path '~/Library/Safari/Bookmarks.plist' | |
plist = CFPropertyList::List.new file: path | |
list = plist.value.value["Children"].value.select do |item| | |
if title = item.value["Title"] | |
title.value == 'com.apple.ReadingList' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/** | |
Determine whether Optional collection is nil or an empty collection | |
:param: collection Optional collection | |
:returns: true if collection is nil or if it is an empty collection, false otherwise | |
*/ | |
public func isNilOrEmpty<C: CollectionType>(collection: C?) -> Bool { | |
switch collection { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Taken zigmob's (http://forums.macrumors.com/showthread.php?t=1742566) workaround a step further | |
And added some triggers to clean up these dodgy character combinations (ff, fi, fl). | |
Still crashes on initial message read but saves having to manually run the sql query eve time a message contains the character combinations */ | |
-- Working well for me so far -- | |
CREATE TRIGGER insert_Ff AFTER INSERT ON ZWAMESSAGE | |
BEGIN | |
UPDATE ZWAMESSAGE | |
SET ZTEXT = replace( ZTEXT, 'ff', 'f f') | |
WHERE ZWAMESSAGE.ZTEXT like '%ff%'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
extension NSObject { | |
func tap(blk:(AnyObject) -> Void) -> Self { | |
blk(self as NSObject) | |
return self | |
} | |
} | |
// Alternative, you will need to specify the type :: view:NSView = ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Let's define a basic Swift class. | |
class Fruit { | |
var type=1 | |
var name="Apple" | |
var delicious=true | |
} | |
// We can get at some info about an instance of an object using reflect(), which returns a Mirror. | |
reflect(Fruit()).count | |
reflect(Fruit())[1].0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OpenStruct < BasicObject | |
def initialize(hash) | |
@struct = ::Struct.new(*hash.keys.map { |k| k.to_sym }) | |
@struct = @struct.new(*hash.values) | |
end | |
def ==(other) | |
to_h == other.to_h | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from http://PSPDFKit.com. This snippet is under public domain. | |
#define UIKitVersionNumber_iOS_7_0 0xB57 | |
BOOL PSPDFIsUIKitFlatMode(void) { | |
static BOOL isUIKitFlatMode = NO; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
// We get the modern UIKit if system is running >= iOS 7 and we were linked with >= SDK 7. | |
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) { | |
isUIKitFlatMode = (NSVersionOfLinkTimeLibrary("UIKit") >> 16) >= UIKitVersionNumber_iOS_7_0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UI- and App Frameworks Evangelist - Jake Behrens, [email protected], twitter: @Behrens | |
- What's new in Cocoa | |
- Accessibility in iOS | |
- Building User Interfaces for iOS 7 | |
- Getting Started with UIKit Dynamics | |
- What's new in Cocoa Touch | |
- What's New With Multitasking | |
- Best Practices for Cocoa Animation | |
- Improving Power Efficiency with App Nap | |
- Introducing Text Kit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env = if ENV['dev'] == '1' | |
'dev' | |
elsif ENV['adhoc'] == '1' | |
'adhoc' | |
else | |
'dev' #default | |
end | |
if env == 'dev' | |
app.codesign_certificate = 'iPhone Developer: Hwee Boon Yar (something)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script builds the iOS and Mac openSSL libraries | |
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script | |
# Credits: | |
# https://github.com/st3fan/ios-openssl | |
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh | |