- 1 sản phẩm có nhiều nhóm biến thể
- Mỗi nhóm biến thể đại diện bời 1 hoặc nhiều thuộc tính của sản phẩm
- Mỗi biến thể có thể được bán bời 1 hoặc nhiều seller
- Quản trị viên có thể quy định một số thuộc tính không được làm dùng để tạo ra nhóm biến thể
- Quản trị viên có thể quy định một số thuộc tính bắt buộc nhập từ phía người bán
- Người bán có quyền tạo ra nhóm biến thể và biến thể (chỉ cần xác nhận bời quản trị viên)
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func MakeMagicSquare(n int) [][]int { | |
ret := make([][]int, n) | |
for i := range ret { |
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 LinkList: | |
def __init__(self): | |
self.head = None | |
self.size = 0 | |
def get(self, position): | |
if position > self.size: | |
raise ValueError('Position invalid') | |
ret = self.head | |
for _ in range(position): |
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 Heap: | |
def __init__(self, compare_fn=lambda x, y: x < y): | |
self._data = [] | |
self._compare_fn = compare_fn | |
def _swap(self, i, j): | |
self._data[i], self._data[j] = self._data[j], self._data[i] | |
@property | |
def top(self): |
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 binary_search(arr, key, start, end): | |
if start == end: | |
return None | |
mid = (start + end) // 2 | |
val = arr[mid] | |
if val == key: | |
return mid | |
if key < val: | |
return binary_search(arr, key, start, mid) | |
return binary_search(arr, key, mid+1, end) |
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 socket | |
from selectors import ( | |
DefaultSelector, | |
EVENT_READ, | |
EVENT_WRITE, | |
) | |
import time | |
selector = DefaultSelector() | |
n_tasks = 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
for i in range(2): | |
print('Hello World') | |
for i in range(3): | |
print('Hello World') |
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
server { | |
listen 80; | |
server_name demo; | |
location / { | |
proxy_pass http://127.0.0.1:8000; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; |
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.staticfiles.urls import static | |
from django.conf import settings | |
urlpatterns += static( | |
prefix=getattr(settings, 'STATIC_URL'), | |
document_root=getattr(settings, 'STATIC_ROOT') | |
) |
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
STATIC_URL = '/static/' | |
STATIC_ROOT = '/var/demo/static' |