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
draft.append("Hello, World!") | |
draft.addTag("greeting"); | |
draft.update(); |
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
// Get the Weekend Repeat Draft | |
let uuid="5B76AC79-9D32-44B8-9EE9-18EF04223225" | |
let draft = Draft.find(uuid); | |
// If Weekend Repeat is Found | |
if (draft) { | |
// Iterate each line | |
for (let task of draft.lines) { | |
if (!task.startsWith("#")) { | |
// Create new draft |
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
package edu.bhcc; | |
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.sql.*; | |
/** | |
* Load Budget from CSV File. | |
*/ |
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
create table CATEGORY ( | |
CATEGORY_ID int NOT NULL AUTO_INCREMENT, | |
CATEGORY_NAME varchar(50), | |
ALLOCATED FLOAT, | |
PRIMARY KEY (CATEGORY_ID) | |
); | |
create table TRANSACTION ( | |
TRANSACTION_ID int NOT NULL AUTO_INCREMENT, | |
PAYEE varchar(50), |
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 collections import Counter | |
fruits = ["orange", "orange", "apple", | |
"orange", "apple", "banana", "orange"] | |
fruit_counts = Counter(fruits) | |
counts = fruit_counts.most_common(3) | |
print (counts) |
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
def calculate_total(book_list): | |
"""Calculate Total of all Books.""" | |
total = 0 | |
for book in book_list: | |
total += book["price"] | |
return total | |
def calculate_shipping(total): | |
"""Calculate Shipping Cost.""" | |
if total > 100: |
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 azure.functions as func | |
from .http_asgi import AsgiMiddleware | |
import mimesis | |
import fastapi | |
import asyncio | |
app = fastapi.FastAPI() | |
@app.get("/user/{user_id}") | |
async def get_user(user_id: int): |
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
# FastAPI + MongoDB | |
# Option 3: Use the async Motor library. | |
import motor.motor_asyncio | |
from fastapi import FastAPI, status | |
import os | |
from typing import List | |
# Sample Movie Database from Atlas MongoDB | |
DB = "sample_mflix" | |
MSG_COLLECTION = "movies" |
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
# FastAPI + MongoDB | |
# Option 2: Use a Single MongoClient. | |
from pymongo import MongoClient | |
from fastapi import FastAPI | |
import os | |
from typing import List | |
# Sample Movie Database from Atlas MongoDB | |
DB = "sample_mflix" | |
MSG_COLLECTION = "movies" |
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
# FastAPI + MongoDB | |
# Option 1: Use Context Managers via the with statement. | |
from pymongo import MongoClient | |
from fastapi import FastAPI | |
from typing import List | |
import os | |
# Sample Movie Database from Atlas MongoDB | |
DB = "sample_mflix" | |
MSG_COLLECTION = "movies" |
NewerOlder