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
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc"> | |
<dependencies> | |
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/> | |
</dependencies> | |
<scenes> | |
<!--View Controller--> | |
<scene sceneID="ufC-wZ-h7g"> | |
<objects> | |
<viewController id="vXZ-lx-hvc" customClass="ViewController" sceneMemberID="viewController"> |
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
- (void)layoutSubviews { | |
[super layoutSubviews]; | |
void objc_msgSend(); | |
NSLog(@"%@", ((id(*)(id,SEL))objc_msgSend)(self, @selector(recursiveDescription))); | |
NSLog(@"hcons: %@", [self constraintsAffectingLayoutForAxis:UILayoutConstraintAxisHorizontal]); | |
NSLog(@"vcons: %@", [self constraintsAffectingLayoutForAxis:UILayoutConstraintAxisVertical]); | |
} |
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/Foundation.h> | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
NSMutableArray *myNums = [NSMutableArray array]; | |
NSString *inputs = @"392 392 339 394 393 394 339"; | |
for (NSString *word in [inputs componentsSeparatedByString:@" "]) { | |
NSNumber *n = [NSDecimalNumber decimalNumberWithString:word]; | |
[myNums addObject:n]; |
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/Foundation.h> | |
int gcd(int a, int b) { | |
// assumes a >= 0 && b > 0 | |
while (b != 0) { | |
int t = a % b; | |
a = b; | |
b = t; | |
} | |
return 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
#define objc_msgSend(...) (objc_msgSend_without_cast())(__VA_ARGS__) | |
static inline id (*objc_msgSend_without_cast(void))(id, SEL, ...) __attribute__((deprecated("objc_msgSend must be cast to the correct type"))); | |
static inline id (*objc_msgSend_without_cast(void))(id, SEL, ...) { | |
return objc_msgSend; | |
} |
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
Errors in the squashing whitespace example code: | |
main.m:13:57: error: expected ';' at end of declaration | |
NSString *string = @"Lorem ipsum dolar sit amet ." | |
^ | |
main.m:14:90: error: extraneous ']' before ';' | |
string = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]]; | |
^ |
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
(defun mayoff:open-url-in-chrome (url) | |
"Open URL in Google Chrome. I use AppleScript to do several things: | |
1. I tell Chrome to come to the front. If Chrome wasn't launched, this will also launch it. | |
2. If Chrome has no windows open, I tell it to create one. | |
3. If Chrome has a tab showing URL, I tell it to reload the tab, make that tab the active tab in its window, and bring its window to the front. | |
4. If Chrome has no tab showing URL, I tell Chrome to make a new tab (in the front window) showing URL." | |
(when (symbolp url) | |
; User passed a symbol instead of a string. Use the symbol name. | |
(setq url (symbol-name url))) | |
(do-applescript (format " |
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 XCPlayground | |
import Foundation | |
import UIKit | |
func maskCorners(corners: [UIViewContentMode], ofView view: UIView, toDepth depth: CGFloat) { | |
let s = 1 + 2 * depth | |
let path = UIBezierPath() | |
if corners.contains(.TopLeft) { | |
path.moveToPoint(CGPoint(x: 0, y: 0 + depth)) |
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/Foundation.h> | |
#import <vector> | |
// index 0 is the least significant digit | |
typedef std::vector<uint16_t> BigInt; | |
static void insertDecimalDigit(BigInt &b, uint16_t decimalDigit) { | |
uint32_t carry = decimalDigit; | |
for (size_t i = 0; i < b.size(); ++i) { | |
uint32_t product = b[i] * (uint32_t)10 + carry; |
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
# command alias rd expression -o -- [[UIApp keyWindow] recursiveDescription] | |
command regex rd 's/^[[:space:]]*$/po [[UIApp keyWindow] recursiveDescription]/' 's/^(.+)$/po [%1 recursiveDescription]/' | |
command regex rsd 's/.*/po [UIApp Rob_recursiveSceneDescription]/' | |
command script import ~/.../lldb/sniff_objc_exception_throw.py | |
command regex hcons 's/^(.+)$/po [(id)%1 constraintsAffectingLayoutForAxis:0]/' | |
command regex vcons 's/^(.+)$/po [(id)%1 constraintsAffectingLayoutForAxis:1]/' |
OlderNewer