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
func loadUsers() { | |
Alamofire.request("https://api.github.com/search/users?q=language:swift&sort=followers") | |
.validate() | |
.responseData { [weak self] (response) in | |
switch response.result { | |
case .success: | |
guard let data = response.data else { | |
print("empty data received.. handle error") | |
return | |
} |
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
//Just an initial draft | |
func color(for row: Int) -> UIColor { | |
let block = { (row: Int) -> CGFloat in | |
let floatValue = min(CGFloat(row), maxValue) | |
return floatValue / maxValue | |
} | |
let green = block(row) | |
let red = block(10 - row) |
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
func startSession() { | |
//Capture Session | |
let session = AVCaptureSession() | |
session.sessionPreset = AVCaptureSessionPresetPhoto | |
//Add device | |
let device = | |
AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeVideo) |
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
//reference https://gist.github.com/tempire/0bd8cb78290aa9bc6adf | |
func addSignature(_ signature:UIImage, onPDFAt path: String) { | |
let pdf = CGPDFDocument(NSURL(fileURLWithPath: path))! | |
let pageCount = pdf.numberOfPages; | |
UIGraphicsBeginPDFContextToFile(path, CGRect.zero, nil) | |
for index in 1...pageCount { |
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
xctool -workspace ProjectName.xcworkspace -scheme ProjectName clean | |
#for project use | |
#xctool -workspace ProjectName.xcodeproj -scheme ProjectName clean | |
xctool -workspace ProjectName.xcodeproj -scheme ProjectName -reporter json-compilation-database:compile_commands.json build | |
#for project use | |
#xctool -project ProjectName.xcodeproj -scheme BLEDataTransfer -reporter json-compilation-database:compile_commands.json build | |
oclint-json-compilation-database -- oclint_args -report-type html -o report.html |
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 { | |
//register for keyboard notification | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardShow:) name:UIKeyboardWillShowNotification object:nil]; | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardShow:) name:UIKeyboardDidShowNotification object:nil]; | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; | |
} | |
- (void)dealloc { | |
[[NSNotificationCenter defaultCenter] removeObserver:self]; | |
} |
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
#!/bin/sh | |
# MakeYosemite.sh | |
# | |
# | |
# Created by Johnykutty on 12/24/14. | |
# | |
red_color='\033[1;31m' | |
green_color='\033[0;32m' |