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
| # post_loc.txt contains the json you want to post | |
| # -p means to POST it | |
| # -H adds an Auth header (could be Basic or Token) | |
| # -T sets the Content-Type | |
| # -c is concurrent clients | |
| # -n is the number of requests to run in the test | |
| ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/ |
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/local/opt/python/bin/python2.7 | |
| # Required ffmpeg | |
| import os | |
| import sys | |
| walk_dir = os.getcwd() | |
| count = 0 | |
| for root, subdirs, files in os.walk(walk_dir): | |
| for file in files: |
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/local/opt/python/bin/python2.7 | |
| # Required ffmpeg | |
| import os | |
| import sys | |
| walk_dir = os.getcwd() | |
| count = 0 | |
| for root, subdirs, files in os.walk(walk_dir): | |
| for file in files: |
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
| // I dont want my table jumping/animation when appending new rows | |
| // for an infinite scroll feel | |
| // | |
| // Some of this might not be needed but it works | |
| // | |
| // TODO: Possibly garbage | |
| extension UITableView { | |
| func reloadDataSmoothly() { | |
| UIView.setAnimationsEnabled(false) |
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
| interface LoginContracts { | |
| interface View { | |
| fun showError(message: String) | |
| } | |
| interface Presenter { | |
| fun onDestroy() | |
| fun onLoginButtonPressed(username: String, password: String) | |
| } | |
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> | |
| @interface Log : NSObject | |
| extern void SSLog(BOOL releaseLog, NSString *format, ...) NS_FORMAT_FUNCTION(2,3); | |
| @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
| - (CGFloat)heightForAttributedString:(NSAttributedString *)text maxWidth:(CGFloat)maxWidth { | |
| if ([text isKindOfClass:[NSString class]] && !text.length) { | |
| // no text means no height | |
| return 0; | |
| } | |
| NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading; | |
| CGSize size = [text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) options:options context:nil].size; |
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
| // | |
| // CFCustomeImageView.h | |
| // | |
| // Created by Tobi Omotayo on 24/10/2016. | |
| // Copyright © 2016 Tobi Omotayo. All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> | |
| @interface CFCustomeImageView : UIImageView { |
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)reserveAuth | |
| { | |
| NSString * http_method = @"POST"; | |
| NSString * request_url = @"https://api.twitter.com/oauth/request_token"; | |
| NSString * oauth_consumer_key = @"bcn3PUKI0PZoxfPTqEDkMru9A"; | |
| NSString * oauth_consumer_secret = @"YiVeSteQBplk8xzAtuoulA7i2vLkVF5kIwc5x1A6ZaxmugdmXg"; | |
| NSString * oauth_nonce = [[NSUUID UUID] UUIDString]; | |
| NSString * oauth_signature = @""; | |
| NSString * oauth_signature_method = @"HMAC-SHA1"; |
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
| @implementation UIImageView (Asynchronous) | |
| + (instancetype _Nonnull)imageViewWithURL:(NSString * _Nonnull )url { | |
| return [self imageViewWithURL:url completionHandler:nil]; | |
| } | |
| + (instancetype _Nonnull)imageViewWithURL:(NSString * _Nonnull )url | |
| completionHandler:(completionHandler _Nullable)block { | |
| UIImageView *imageView = [UIImageView new]; | |
| [imageView loadImageWithURL:url completionHandler:block]; |
NewerOlder