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
{"lastUpload":"2020-12-28T21:41:20.271Z","extensionVersion":"v3.4.3"} |
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 merge(lefthalf, righthalf): | |
i=j=0 | |
sorted_list = [] | |
while i < len(lefthalf) and j < len(righthalf): | |
if lefthalf[i] < righthalf[j]: | |
sorted_list.append(lefthalf[i]) | |
i=i+1 | |
else: | |
sorted_list.append(righthalf[j]) |
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
<template> | |
<div id="todos-vue"> | |
<div> | |
<label>New task:</label> | |
<!-- use v-model for 2-way binding, call method when user press enter @keyup.enter--> | |
<input id="new_todo" v-model="new_todo" placeholder="edit me" @keyup.enter="add_todo()"> | |
<button @click="add_todo()">Add</button> | |
</div> | |
<div> | |
<div v-for="(todo, index) in todos" :key="todo.id"> |
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
<script> | |
export default { | |
name: "todo_comp", | |
data: function() { | |
return { | |
new_todo: "", | |
todos: [ | |
{ id: 1, content: "write paper", done: false }, | |
{ id: 2, content: "read paper", done: false }, | |
{ id: 3, content: "review paper", done: false } |
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
<template> | |
<div class="todo"> | |
<todo_comp/> | |
</div> | |
</template> | |
<script> | |
// @ is an alias to /src | |
import todo_comp from '@/components/todo_comp.vue' |
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 os | |
class Config(object): | |
SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db' | |
SECRET_KEY = os.environ.get("SECRET_KEY") or "super-secret-key" | |
DEBUG = True | |
CSRF_ENABLED = 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
from flask import Flask, render_template, jsonify, request | |
from config import Config | |
from flask_sqlalchemy import SQLAlchemy | |
from flask_restful import Resource, Api | |
from flask_cors import CORS | |
# https://flask-marshmallow.readthedocs.io/en/latest/ | |
from flask_marshmallow import Marshmallow | |
import os | |
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 requests | |
# using requests library to test backend without using frontend | |
def query(): | |
response = requests.get('http://localhost:5000/todo_db') | |
print(response.json()) | |
query() | |
# add new item |
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
<template> | |
<div id="todos-vue"> | |
<div> | |
<label>New task:</label> | |
<!-- use v-model for 2-way binding, call method when user press enter @keyup.enter--> | |
<input id="new_todo" v-model="new_todo" placeholder="edit me" @keyup.enter="add_todo()"> | |
<button @click="update_todo(id=-1, content=new_todo, done=false, delete_=false)">Add</button> | |
</div> | |
<div> | |
<div v-for="(todo) in todos" :key="todo.id"> |
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
<template> | |
<div id="app"> | |
<v-app> | |
<!-- drawer is the section popup from the left--> | |
<v-navigation-drawer fixed v-model="drawer" app> | |
<v-list dense> | |
<!-- use a v-for to automatically generate --> | |
<li v-for="route in routes" :key="route.id"> | |
<v-list-tile @click="change_view(route.name)"> | |
<v-list-tile-action> |
OlderNewer