This file contains hidden or 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:[email protected]/test?retryWrites=true&w=majority") | |
db = client.test | |
collection = db.test | |
post = { | |
"_id": 1, | |
"name": "sid", |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
// Taken from https://medium.com/swlh/vue3-using-ref-or-reactive-88d47c8f6944 | |
// ##001 : import from vue3: | |
// - reactive for making properties reactive; | |
// - computed for computed function like total | |
// - toRefs for destructuring object for template | |
import { reactive, computed, toRefs } from "vue"; | |
export default { | |
name: 'RollTheDiceReactive', | |
// ##002 : implement setup function |
This file contains hidden or 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> | |
<section class="resume-content p-3 p-lg-5 d-flex justify-content-center" id="projects"> | |
<div class="w-100"> | |
<h2 class="mb-5 text-darker">Projects</h2> | |
<div | |
class="resume-item d-flex flex-column flex-md-row justify-content-between mb-5" | |
v-for="(repo, index) in projects" | |
:key="index" | |
> | |
<div class="resume-content"> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | |
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> | |
<title><%= htmlWebpackPlugin.options.title %></title> | |
</head> | |
<body> |
This file contains hidden or 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
# Possible due to https://gist.github.com/yanofsky/5436496 | |
import csv | |
import json | |
import re | |
import pytz | |
import tweepy | |
def those_tweets(screen_name=TWEETARATI): |
NewerOlder