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
Show hidden characters
{ | |
"esnext": true, | |
"forin": true, | |
"es5": false, | |
"curly": true, | |
"eqeqeq": false, | |
"newcap": true, | |
"noarg": true, | |
"noempty": true, | |
"nonew": 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
#include <iostream> | |
#define INF 2147483647 | |
using namespace std; | |
const int N = 8; | |
int a[N] = {4,5,-4,3,-4,-20,4,-5}; | |
int main() { | |
int ans = -INF, |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> | |
<persistence-unit name="bookChange" transaction-type="RESOURCE_LOCAL"> | |
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> | |
<class></class> | |
<properties> | |
<property name="javax.persistence.jdbc.password" value="root"/> | |
<property name="javax.persistence.jdbc.user" value="ceoro9"/> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" | |
version="2.1"> | |
<persistence-unit name="bookChange" transaction-type="RESOURCE_LOCAL"> | |
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> | |
<class></class> | |
<properties> |
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
# models.py (app registration) | |
from django.contrib.auth.models import AbstractUser | |
from django.db import models | |
class CoffeehouseUser(AbstractUser): | |
age = models.IntegerField(blank=True,null=True) | |
telephone = models.CharField(max_length=15,blank=True,null=True) | |
#... | |
# admin.py (app registration) |
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 myUserCreationForm(UserCreationForm): | |
#additional fields | |
class Meta: | |
model = User | |
fields = ('username', 'password1', 'password2') | |
def __init__(self, *args, **kwargs): | |
super(UserCreationForm, self).__init__(*args, **kwargs) | |
#set classes for css |
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
#!/usr/bin/python3.6 | |
import redis | |
import threading | |
class Listener(threading.Thread): | |
def __init__(self, r, channels): | |
super(Listener, self).__init__() | |
self.redis = r | |
self.pubsub = self.redis.pubsub() | |
self.pubsub.subscribe(channels) |
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
def get_default_password_validators(): | |
return get_password_validators(settings.AUTH_PASSWORD_VALIDATORS) | |
def get_password_validators(validator_conf): | |
""" | |
import all password validators modules | |
and raise exception if impossible to import | |
:param validator_conf: | |
: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
# -*- coding: utf-8 -*- | |
# Generated by Django 1.11 on 2018-01-22 17:31 | |
"""Load data using py and sqlq | |
... | |
""" | |
from __future__ import unicode_literals | |
from django.db import migrations |
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 PostSerializer(serializers.ModelSerializer): | |
field = serializers.SerializerMethodField() | |
def get_field(self, obj): | |
return self.obj.context['example] | |
serialize = PostSerializer(obj, context={'example': 'example'}) |
OlderNewer