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
- (UIViewController *)topViewController{ | |
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; | |
} | |
- (UIViewController *)topViewController:(UIViewController *)rootViewController | |
{ | |
if (rootViewController.presentedViewController == nil) { | |
return rootViewController; | |
} | |
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
// | |
// Created by ddrccw on 14-1-10. | |
// Copyright (c) 2014年 ddrccw. All rights reserved. | |
// refer to http://danqingdani.blog.163.com/blog/static/1860941952012102122847478/ | |
#import <sys/stat.h> | |
#import <mach-o/dyld.h> | |
//#import <stdlib.h> | |
//#import <string.h> |
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
+(int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay | |
{ | |
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
[dateFormatter setDateFormat:@"dd-MM-yyyy"]; | |
NSString *oneDayStr = [dateFormatter stringFromDate:oneDay]; | |
NSString *anotherDayStr = [dateFormatter stringFromDate:anotherDay]; | |
NSDate *dateA = [dateFormatter dateFromString:oneDayStr]; | |
NSDate *dateB = [dateFormatter dateFromString:anotherDayStr]; | |
NSComparisonResult result = [dateA compare:dateB]; | |
NSLog(@"date1 : %@, date2 : %@", oneDay, anotherDay); |
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
// Compile with: | |
// clang catchredir.m -o catchredir -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ -miphoneos-version-min=7 -framework Foundation | |
#import <Foundation/Foundation.h> | |
#import <stdio.h> | |
#import <objc/runtime.h> | |
@interface UrlConnection : NSObject | |
@property (strong) NSString *url; | |
- (void)connect; | |
@end |
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
<?php | |
// Converts a number into a short version, eg: 1000 -> 1k | |
// Based on: http://stackoverflow.com/a/4371114 | |
function number_format_short( $n, $precision = 1 ) { | |
if ($n < 900) { | |
// 0 - 900 | |
$n_format = number_format($n, $precision); | |
$suffix = ''; | |
} else if ($n < 900000) { |
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
# Assumes an Apple-like layout: leaf --> issuer --> CA in exactly 3 certs | |
# The last arg to codesign specifies the code to check, by bundle or executable path, or process ID | |
codesign -d -vv --extract-certificates=cert I-didnt-edit-my-config-file | |
for i in 0 1 2 ; do openssl x509 -inform der -in cert${i} -out cert${i}.pem ; done | |
openssl ocsp -CAfile cert2.pem -issuer cert1.pem -cert cert0.pem -url $(openssl x509 -in cert0.pem -ocsp_uri -noout) | |
Example: | |
╭─ andre@flux ~ |
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
@protocol AutoHook <NSObject> | |
@required | |
+ (NSArray <NSString *> *)targetClasses; | |
@end |
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
<?php | |
function string2ByteArray($string) { | |
return unpack('C*', $string); | |
} | |
function byteArray2String($byteArray) { | |
$chars = array_map("chr", $byteArray); | |
return join($chars); | |
} |
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 Header File is used in combination********// | |
//**with a dynamic Library and must be rewritten**// | |
//**if you want to use it for another purpose****// | |
//**********************************************// | |
//******************************************// | |
//**Credits: HackJack & Razzile(Kamizoom)**// | |
//****************************************// |
OlderNewer