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> | |
| #include <dlfcn.h> | |
| NSDictionary *FCPrivateBatteryStatus() | |
| { | |
| static mach_port_t *s_kIOMasterPortDefault; | |
| static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options); | |
| static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT); | |
| static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name); |
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
| // | |
| // IPInsetLabel.h | |
| // Instapaper | |
| // | |
| // Created by Marco Arment on 7/23/11. | |
| // Copyright 2011 Instapaper LLC, released to the public domain. | |
| // | |
| #import <UIKit/UIKit.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
| if pgrep "iOS Simulator"; then | |
| killall "iOS Simulator" | |
| fi | |
| if pgrep "Xcode"; then | |
| killall "Xcode" | |
| fi | |
| xcrun simctl list | awk -F "[()]" '{ for (i=2; i<NF; i+=2) print $i }' | grep '^[-A-Z0-9]*$' | xargs -I uuid xcrun simctl erase uuid | true | |
| echo $? |
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
| //This is xxx.h | |
| /* | |
| //#import <ifaddrs.h> | |
| //#import <arpa/inet.h> | |
| @interface TKUWiFiInformation : NSObject | |
| - (NSString *)getIPAddress; | |
| @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
| #!/bin/sh | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # Set the colours you can use | |
| black='\033[0;30m' | |
| white='\033[0;37m' | |
| red='\033[0;31m' |
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"?> | |
| <Bucket | |
| type = "2" | |
| version = "2.0"> | |
| <Breakpoints> | |
| <!-- All Exceptions --> | |
| <BreakpointProxy | |
| BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint"> | |
| <BreakpointContent |
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 | |
| search_dir = ARGV[0] || "." | |
| files = Dir.glob("#{search_dir}/**/*.{h,m,swift}") | |
| if files.length > 0 | |
| puts "Found the following header or implementation files in '#{search_dir}':" | |
| files.each do |filepath| | |
| puts filepath |
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
| + (UIImage *)decompressedImageWithImage:(UIImage *)image resizeTo:(CGSize)targetSize | |
| { | |
| CGImageRef imageRef = image.CGImage; | |
| CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
| CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef); | |
| BOOL sameSize = NO; | |
| if (CGSizeEqualToSize(targetSize, CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)))) { | |
| targetSize = CGSizeMake(1, 1); | |
| sameSize = YES; | |
| } |
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)rotatePath:(UIBezierPath *)path degree:(CGFloat)degree { | |
| CGRect bounds = CGPathGetBoundingBox(path.CGPath); | |
| CGPoint center = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); | |
| CGFloat radians = (degree / 180.0f * M_PI); | |
| CGAffineTransform transform = CGAffineTransformIdentity; | |
| transform = CGAffineTransformTranslate(transform, center.x, center.y); | |
| transform = CGAffineTransformRotate(transform, radians); | |
| transform = CGAffineTransformTranslate(transform, -center.x, -center.y); | |
| [path applyTransform:transform]; |
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
| * As an optimization, dispatch_sync() invokes the block on the current | |
| * thread when possible. | |
| dispatch_sync(dispatch_get_global_queue(0, 0), ^{ | |
| [[NSOperationQueue mainQueue] addOperationWithBlock:^{ | |
| NSLog(@"First"); | |
| }]; | |
| [[NSOperationQueue currentQueue] addOperationWithBlock:^{ |