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 *urlString = @"api/refundo/connect_chat"; | |
NSURL *URL = [NSURL URLWithString:urlString relativeToURL:self.baseURL]; | |
NSDictionary *parameters = @{@"nonce": nonce, | |
@"user_id":[self getTaxPayerEmail]}; | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; | |
request.HTTPMethod = @"POST"; | |
request.HTTPBody = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; |
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
# simple class with no models mappings | |
class LayerAuthSerializer(serializers.Serializer): | |
nonce = serializers.CharField() | |
display_name = serializers.CharField(required=False) | |
avatar_url=serializers.CharField(required=False) | |
# a complex class definition | |
class CreateUserSerializer(serializers.Serializer): | |
""" |
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
# restart | |
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start | |
#stop manually | |
pg_ctl -D /usr/local/var/postgres stop -s -m fast | |
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
/Library/Python/2.7/site-packages |
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
pip freeze | grep celery |
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
# contains only values passed on function invokation | |
*args | |
# contains only key-values passed on function invokation | |
**kwargs | |
# function definition and user | |
def table_things(*args,**kwargs): | |
# works normal python dictionary | |
user = kwargs.pop('user',None) |
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 rest_framework import serializers | |
raise serializers.ValidationError({ | |
'error': 'User already has liked this news.', | |
'code' : exception_handler.ERROR_DATA_INCONSISTENCY | |
}) |
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
date_joined = models.DateTimeField(help_text=('date joined'), default=timezone.now) | |
company = models.CharField(max_length=200, blank=True, null=True, | |
help_text=("Current company user is working for"), | |
) | |
# foreign key with no related name | |
user = models.ForeignKey( | |
User, | |
on_delete=models.CASCADE, | |
related_name='+', | |
) |
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
getSupportFragmentManager() | |
.beginTransaction() | |
.add(containerViewId, fragment, fragmentTag) | |
.disallowAddToBackStack() | |
.commit(); |
OlderNewer