This file contains 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
extension UIView { | |
/// Example: call someView.nudge(0, 30) | |
func nudge(_ dx: CGFloat, _ dy: CGFloat) { | |
self.frame = self.frame.offsetBy(dx: dx, dy: dy) | |
CATransaction.flush() | |
} | |
} | |
extension UIView { | |
/// Example: po UIView.root |
This file contains 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
# Calling functions | |
expression CATransaction.flush() | |
call CATransaction.flush() | |
# Assigning variables | |
expression didLoad = true | |
command alias assign expression -- | |
assign didLoad = true | |
# Symbolic breakpoints |
This file contains 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
/* | |
* This is an example provided by Facebook are for non-commercial testing and | |
* evaluation purposes only. | |
* | |
* Facebook reserves all rights not expressly granted. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | |
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
This file contains 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 re | |
import __builtin__ | |
from itertools import islice | |
# See https://sourceware.org/gdb/current/onlinedocs/gdb/Convenience-Funs.html | |
# breakpoint command add -F '_caller_is("theCaller")' | |
# breakpoint command add -F 'not _caller_is("theCaller")' | |
def _caller_is(name): | |
def check(frame, loc, _): |
This file contains 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
wut() { | |
readonly error_code=$1 | |
local domain | |
for domain in posix mach; do | |
tput bold; echo $domain; tput sgr0 | |
launchctl error $domain $error_code | |
done | |
tput bold; echo security; tput sgr0 | |
security error $error_code |
This file contains 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
# Examples: | |
# hdrtomod objc/runtime.h | |
# hdrtomod mach-o/dyld.h | |
# hdrtomod Foundation/Foundation.h | |
hdrtomod() { | |
readonly header=$1 | |
echo "#import <$header>" \ | |
| clang -fmodules -fsyntax-only -x objective-c -Xclang -ast-dump - \ | |
| grep ImportDecl \ | |
| egrep -o 'implicit \S+' |
This file contains 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 addMainThreadCheck(Class cls, SEL selector) { | |
#if DEBUG | |
void *symbol = dlsym(RTLD_DEFAULT, "__main_thread_add_check_for_selector"); | |
if (!symbol) { | |
return; | |
} | |
void (*addCheck)(Class, SEL) = (__typeof__(addCheck))symbol; | |
addCheck(cls, selector); | |
#endif | |
} |
This file contains 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
b hitTest:withEvent: | |
break command add -s python -o 'print frame.EvaluateExpression("$arg1").description; return False' |
This file contains 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
- (RACSignal *)distinct { | |
return [RACSignal defer:^{ | |
NSMutableSet *set = [NSMutableSet new]; | |
NSObject *nullObject = [NSObject new]; | |
return [self filter:^(id x) { | |
x = x ?: nullObject; | |
BOOL distinct = ![set containsObject:x]; | |
if (distinct) [set addObject:x]; |
This file contains 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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
@weakify(self); | |
self.exploreSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, mTCTableViewFrameWidth, 44)]; | |
self.exploreSearchBar.placeholder = @"Search"; | |
[self.exploreSearchBar setBackgroundImage:[UIImage squareImageWithColor:mTCLightTanColor dimension:1] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; | |
self.tableView.tableHeaderView = self.exploreSearchBar; |