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 ProfileSerializer(serializers.HyperlinkedModelSerializer): | |
owner = serializers.ReadOnlyField(source='owner.username') | |
class Meta: | |
model = Profile | |
field = ('name', 'dob', 'address', 'phone', 'description', 'email', 'image', 'owner', 'bkgbImage') |
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 Profile(models.Model): | |
name = models.CharField(max_length=50, blank=True, default='') | |
dob = models.DateField(blank=True, default=timezone.now) | |
phone = models.CharField(max_length=50, blank=True, default='') | |
address = models.CharField(max_length=100, blank=True, default='') | |
description = models.TextField(blank=True, default='') | |
email = models.CharField(max_length=50, blank=True, default='') | |
image = models.CharField(max_length=300, blank=True, default='') | |
owner = models.ForeignKey('auth.User', related_name='profile') | |
university = models.CharField(max_length=100, blank=True, default='') |
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 Blog(models.Model): | |
title = models.CharField(max_length=100, blank=True, default='') | |
content = models.TextField(default='', blank=True) | |
createTime = models.DateField(blank=True, default=timezone.now) | |
editTime = models.DateField(blank=True, default=timezone.now) | |
owner = models.ForeignKey('auth.User', related_name='blogs') | |
category = models.ForeignKey(BlogCategory, related_name='blogs') | |
shortcut = models.TextField(default='', blank=True) | |
summary = models.CharField(max_length=200, blank=True, default='') |
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
app.factory('Home', ['$resource', | |
function($resource){ | |
return $resource('http://xxx/', {}, { | |
query: {method:'GET'} | |
}); | |
}]); |
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
CORS_ORIGIN_ALLOW_ALL = True |
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
JWT_AUTH = { | |
'JWT_ALLOW_REFRESH': False, | |
'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7), | |
} |
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
Given an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given number target. | |
If the array before adjustment is A, the array after adjustment is B, you should minimize the sum of |A[i]-B[i]| | |
Example: | |
Given [1,4,2,3] and target = 1, one of the solutions is [2,3,2,3], the adjustment cost is 2 and it's minimal. | |
Return 2. | |
Note: | |
You can assume each number in the array is a positive integer and not greater than 100. |
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
public class Solution { | |
/** | |
* @param A: An integer array. | |
* @param target: An integer. | |
*/ | |
public int MinAdjustmentCost(ArrayList<Integer> A, int target) { | |
// write your code here | |
if (A == null || A.size() == 0) { | |
return 0; | |
} |
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
/** | |
* Definition for ListNode. | |
* public class ListNode { | |
* int val; | |
* ListNode next; | |
* ListNode(int val) { | |
* this.val = val; | |
* this.next = null; | |
* } | |
* } |
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
/** | |
* Definition for ListNode. | |
* public class ListNode { | |
* int val; | |
* ListNode next; | |
* ListNode(int val) { | |
* this.val = val; | |
* this.next = null; | |
* } | |
* } |
OlderNewer