To Run an XCode project: ⌘ + R
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/python | |
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected]) | |
# The author disclaims copyright to this source code. | |
import sys | |
import struct | |
import socket | |
import time | |
import select |
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
// Borrowed some stuff from the WWDC 2014 video | |
// Create the action | |
UIMutableUserNotificationAction *acceptAction = [[UIMutableUserNotificationAction alloc] init]; | |
acceptAction.identifier = @"ACCEPT_IDENTIFIER"; | |
acceptAction.title = @"Accept"; | |
acceptAction.activationMode = UIUserNotificationActivationModeBackground; // If we need to show UI, use UIUserNotificationActivationModeForeground | |
acceptAction.destructive = NO; // If YES, shows red button | |
acceptAction.authenticationRequired = NO; // If YES, requires passcode |
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
# Common | |
pod 'BlocksKit' | |
pod 'UIViewController+BlockSegue' | |
pod 'RKDropdownAlert' | |
pod 'UIAlertController+Blocks' | |
pod 'RFKeyboardToolbar' | |
pod 'SDWebImage' | |
pod 'TOWebViewController' | |
pod 'DZNEmptyDataSet' |
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
[UIAlertView bk_showAlertViewWithTitle:@"Location is disabled" | |
message:@"To enable location you need " | |
"to set location to 'Always' in Settings > <#app name#> > Location" | |
cancelButtonTitle:@"Cancel" | |
otherButtonTitles:@[ @"Settings" ] | |
handler:^(UIAlertView *alertView, NSInteger buttonIndex) | |
{ | |
if (buttonIndex == 1) { | |
// Send the user to the Settings for this app | |
NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; |
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
// *** Setup camera *** // | |
- (void)setupCamera | |
{ | |
// setup session | |
self.session = [AVCaptureSession new]; | |
self.session.sessionPreset = AVCaptureSessionPresetPhoto; | |
// setup device | |
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; | |
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
- (CGSize)collectionViewContentSize | |
{ | |
CGSize size = [super collectionViewContentSize]; | |
CGSize cvSize = self.collectionView.frame.size; | |
CGSize newSize = CGSizeMake(size.width, size.height + ((cvSize.height/2) - (self.itemSize.height/2))); | |
return newSize; | |
} | |
// Vertical scrolling | |
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity |
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
@property (nonatomic, strong) UIView *view; | |
- (instancetype)initWithFrame:(CGRect)frame | |
{ | |
self = [super initWithFrame:frame]; | |
if (self) { | |
[self setupViewFromNib]; | |
[self setupUI]; | |
} | |
return self; |
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
// Create path. | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:<#@"Image.png"#>]; | |
// Save image. | |
[UIImage<#PNG#>Representation(image) writeToFile:filePath atomically:<#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
PHObjectPlaceholder *placeholderAsset; | |
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ | |
PHAssetChangeRequest *newAssetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:<#image#>]; | |
newAssetRequest.creationDate = <#time#>; | |
newAssetRequest.location = <#location#>; | |
placeholderAsset = newAssetRequest.placeholderForCreatedAsset; | |
PHAssetCollectionChangeRequest *addAssetRequest = [PHAssetCollectionChangeRequest changeRequestForAssetCollection:<#asset collection#>]; |
OlderNewer