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 codecs | |
from IPython import get_ipython # type: ignore | |
from IPython.core.magic import register_line_cell_magic | |
from IPython.display import clear_output, display, Markdown, update_display # type: ignore | |
from openai import OpenAI | |
from openai.types.chat import ChatCompletionMessageParam | |
from openai.types.chat.completion_create_params import Function | |
import os | |
import re | |
import requests |
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
// Retrieves and recasts the body of an enum | |
func body<T, U>(of value: inout T) -> U { | |
return withUnsafePointer(to: &value) { | |
$0.withMemoryRebound(to: U.self, capacity: 1) { | |
$0.pointee | |
} | |
} | |
} |
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
struct Todo { | |
let title: String | |
let completed: Bool | |
} | |
let storage = PostgreSqlTable<Todo>() | |
let app = CRUDApp<Todo>(storage: storage)() | |
let router = RESTAppRouter(app: app) | |
let server = HTTPSServer(router: router) | |
server.start() |
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 Foundation | |
protocol Mixin { | |
var storage: [String : Any] { get set } | |
} | |
protocol CanMoveMixin : Mixin { | |
var position: CGPoint { get set } | |
var speed: CGVector { get set } |
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
GET /card_catalog/categories?depth=full // Gets full category heirarchy. Takes a few seconds. Would be nice if it were cached. | |
GET /card_catalog/cards?category={category_id} // Only returns 20 cards. Would like all cards for standard catalog categories. | |
Either cache all cards for a given category or cache all catalog cards with category ids included. | |
If the category type is CAT then we should cache it. |