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
#!/bin/bash | |
uv_cmd="uv run main.py add" | |
entries=( | |
"Setup VSCode Environment|Installed Python, Black, Ruff extensions. Enabled linting/formatting.|setup,tools" | |
"Explored FastAPI|Built CRUD API with validation and DI via Pydantic.|fastapi,backend" | |
"Wrote First Pytest Tests|Tested edge cases, mocked APIs, got >90% coverage.|testing,pytest" | |
"Switched to uv|Replaced pip/venv with uv. Much faster setup!|uv,packaging" | |
"Git Aliases Setup|Added aliases like gst, gco, gcm to boost workflow.|git,productivity" |
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
function copyToClipboard(editorInstance) { | |
const code = editorInstance.getValue(); | |
navigator.clipboard.writeText(code).then(() => { | |
alert('Code copied to clipboard!'); | |
}).catch(err => { | |
console.error('Failed to copy: ', err); | |
}); | |
} |
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
# /// script | |
# dependencies = [ | |
# "pydantic", | |
# ] | |
# /// | |
from pydantic import BaseModel | |
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
# /// script | |
# dependencies = [ | |
# "geotext", | |
# ] | |
# /// | |
from geotext import GeoText | |
places = GeoText("I went from Paris to Berlin.") | |
print(places.cities) # ['Paris', 'Berlin'] |
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
# /// script | |
# dependencies = [ | |
# "marvin", | |
# ] | |
# /// | |
import os | |
import sys | |
import argparse | |
import marvin | |
from pydantic import BaseModel, Field |
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
# /// script | |
# dependencies = [ | |
# "marvin", | |
# ] | |
# /// | |
import os | |
import sys | |
import argparse | |
from pydantic import BaseModel, Field |
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
# /// script | |
# dependencies = [ | |
# "bs4", | |
# "httpx", | |
# "typer" | |
# ] | |
# /// | |
import textwrap | |
from bs4 import BeautifulSoup |
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 | |
import csv | |
# set MARVIN_OPENAI_API_KEY in your environment variables | |
import marvin | |
from pydantic import BaseModel | |
import folium | |
class Location(BaseModel): |
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
# initial code | |
def process_data(name, age, address, phone, email): | |
print(f"Processing data for {name}, {age}, living at {address}. Contact info: {phone}, {email}") | |
process_data("Alice", 30, "123 Main St", "555-1234", "[email protected]") | |
# refactored using dataclass | |
from dataclasses import dataclass |
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 os | |
from flask import Flask | |
import sentry_sdk | |
from dotenv import load_dotenv | |
load_dotenv() | |
SENTRY_DSN = os.getenv("SENTRY_DSN") | |
sentry_sdk.init(SENTRY_DSN) |
NewerOlder