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 someRanges = [1..<4, 1..<8, 1..<16, 1..<32, 1..<64, 1..<128, 1..<256, 1..<512, 1..<1024] |
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
| public protocol A { | |
| func methodName() | |
| } | |
| extension A { | |
| func methodName(differentParam: Any) {} | |
| } | |
| class Test: A {} |
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
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| func mergeArrays<T: Comparable>(left: [T], _ right: [T]) -> [T] { | |
| var leftIndex = 0 | |
| var rightIndex = 0 | |
| var orderedArray = [T]() | |
| while leftIndex < left.count && rightIndex < right.count { |
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
| app = [[SBApplicationController sharedInstance] applicationWithBundleIdentifier:@"com.apple.mobilesafari"] | |
| appIcon = [[SBApplicationIcon alloc] initWithApplication:app] | |
| iconView = [[SBIconView alloc] init]; | |
| iconView.icon = appIcon; | |
| iconController = choose(SBIconController)[0] | |
| iconView.delegate = iconController | |
| [iconController _revealMenuForIconView:iconView presentImmediately:1] |
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
| // Usage example : [self addConstraintsWithVisualFormat:@"V:|-0-[myAwesomeView]-0-|", self.awesome, nil]; | |
| // no need to use underscore for property | |
| // Actually would break with priority annotations but who care! It's just an experiment | |
| // Not using NSDictionaryOfVariableBindings(...) to have easy use also in swift | |
| - (void)addConstraintsWithVisualFormat:(NSString *)formatString,... NS_REQUIRES_NIL_TERMINATION { | |
| va_list args; | |
| va_start(args, formatString); | |
| NSString *pattern = @"\\[(.*?)\\]"; |
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
| // | |
| // main.m | |
| // swizzle | |
| // | |
| // Created by Alex Manzella on 04/07/14. | |
| // Copyright (c) 2014 mpow. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> | |
| #import <objc/runtime.h> |
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
| // on iOS 7 present a popover from an UIBarButtonItem is buggy | |
| // the arrow is not uncentered | |
| // as always iOS 7 is broken setImageEdgeInsets | |
| // try that | |
| // the fix consist in setImageEdgeInsets: | |
| - (UIBarButtonItem *)rightItem{ | |
| if (GBIsNativeiPad() && GBIsIOS7()) { // ios 7 sucks |
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
| // | |
| // ViewController.swift | |
| // testSwift | |
| // | |
| // Created by Alex Manzella on 02/06/14. | |
| // Copyright (c) 2014 mpow. All rights reserved. | |
| // | |
| import UIKit |
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
| knownhosts () { | |
| cp ~/.ssh/known_hosts ~/.ssh/known_hosts_$(date +%Y%m%d-%H%M%S) ; | |
| sed -e "$1d" ~/.ssh/known_hosts > ~/.ssh/known_hosts_new ; | |
| mv ~/.ssh/known_hosts_new ~/.ssh/known_hosts ; | |
| chmod 644 ~/.ssh/known_hosts | |
| } |
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
| // I will not tell you why I made this, or you would think I am mad... | |
| // But may be useful in future | |
| // | |
| // Yes is the equivalent of super.. but it's not allowed in categories | |
| + (void)load{ | |
| method_exchangeImplementations(class_getInstanceMethod(self, @selector(setDelegate:)), class_getInstanceMethod(self, @selector(hooked_setDelegate:))); // hook the setDelegate to hook it (later) | |
| } |