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
#Django 10.1 on Python 3.5 | |
#main credit to http://stackoverflow.com/users/2089197/kevin-stone | |
#sub credit to http://stackoverflow.com/users/3694224/kerryz | |
#Questions or problems please reach me at hammadzz on github | |
#The serializers are timezone aware, they will check the timezone of the datetimefield object and serialize to a unix epoch timestamp (it is always in UTC). The magic piece that makes it work correctly is calendar.timegm() | |
#Add these serializers in serializers.py, the best practice is to make a new Django app called utils, and create a serializers.py file there which contains the code in this snippet. I have included an example using it below: | |
#utils/your-django-project/utils/serializers.py | |
from rest_framework import serializers |
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
- (NSString *)stringWithDeviceToken:(NSData *)deviceToken { | |
const char *data = [deviceToken bytes]; | |
NSMutableString *token = [NSMutableString string]; | |
for (NSUInteger i = 0; i < [deviceToken length]; i++) { | |
[token appendFormat:@"%02.2hhX", data[i]]; | |
} | |
return [token copy]; | |
} |
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
//Put this line in application did finish launching | |
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor whiteColor]]; | |
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]]; | |
//Another option | |
//Also use this to prevent to Cancel button text on the popup to disappear | |
[activityController.view setTintColor:[UIColor redColor]]; | |
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
let item: RAMAnimatedTabBarItem = self.tabBarItem as! RAMAnimatedTabBarItem | |
for constraint in (item.iconView!.icon.superview?.constraints)! { | |
if let currentView: UIImageView = constraint.firstItem as? UIImageView { | |
if item.iconView!.icon == currentView { | |
if constraint.firstAttribute == .centerY { | |
constraint.constant = -10; | |
} | |
} | |
} |
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
class tapBarController: UITabBarController, UITabBarControllerDelegate { | |
/// Determines whether the scrolling capability's enabled. | |
var scrollEnabled: Bool = true | |
private var previousIndex = 0 | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
<!-- Disables ATS for any domains --> | |
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
</dict> |
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
#import "ViewController.h" | |
#import <Crashlytics/Crashlytics.h> | |
@interface ViewController () | |
@end | |
@implementation ViewController | |
- (void)logCustomInfo | |
{ | |
CLS_LOG(@"Logging custom info!"); |
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
if [ "${CONFIGURATION}" = "Release" ]; then | |
"${PODS_ROOT}/Fabric/run" <release API Key> <release Build Secret> | |
else | |
"${PODS_ROOT}/Fabric/run" <debug API Key> <debug Build Secret> | |
fi |
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
/// Clear status bar | |
UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent |
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
from django.contrib.auth import get_user_model | |
UserModel = get_user_model() | |
UserModel.objects.all() |
OlderNewer