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
var $ = function (selector, parent) { | |
return (parent ? parent : document).querySelector(selector); | |
}; | |
(function () { | |
$('[data-toggle="offcanvas"]').addEventListener("click", function () { | |
$(".offcanvas-collapse").classList.toggle("open"); | |
}); | |
$('[data-toggle="offsection"]').addEventListener("click", function () { |
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 | |
from flask_wtf import FlaskForm | |
from wtforms import RadioField | |
SECRET_KEY = 'development' | |
app = Flask(__name__) | |
app.config.from_object(__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
from flask import jsonify | |
@app.route('/user_json') | |
def get_json(): | |
user = User.query.filter_by(username='testme').first() | |
# Using the user object (without __dict__) will generate a runtime error | |
# TypeError: 'user' is not JSON serializable | |
return jsonify( user.__dict__ ) |
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 pathlib import Path | |
data_folder = Path("source_data/text_files/") | |
file_to_open = data_folder / "raw_data.txt" | |
f = open(file_to_open) | |
print(f.read()) |
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="ui cards" style="margin: 10px"> | |
<div class="ui icon input" style="width: 100%"> | |
<input type="text" placeholder="Search..." v-model="searchQuery" /> | |
<i class="search icon"></i> | |
</div> | |
<div | |
class="card ui fluid" | |
v-for="product in searchedProducts" | |
:key="product.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
import pymongo | |
from pymongo import MongoClient | |
client = pymongo.MongoClient("mongodb+srv://sidbelbase:password@clusters.mongodb.net/test?retryWrites=true&w=majority") | |
db = client.test | |
collection = db.test | |
post = { | |
"_id": 1, | |
"name": "sid", |
OlderNewer