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
""" | |
# OpenAI Chat Completions Serialization Example | |
## Description | |
This code snippet demonstrates how to serialize the response from the OpenAI Chat Completions API into a JSON format which is useful for sending using REST. | |
It includes a helper function, `serialize_completion`, that takes the completion response object and converts it into a JSON-compatible dictionary. | |
## Usage | |
To use this code, you will need to have a .env file in the same directory as this script with your openai key: | |
OPENAI_API_KEY = "sk-your_key_here" |
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
#include <stdint.h> | |
#include <stdlib.h> | |
#include <vector> | |
#define uint32 uint32_t | |
std::vector<std::vector<uint32>> combinations(std::vector<uint32> src, uint32 r) { | |
std::vector<std::vector<uint32>> cs; | |
if (r == 1) { | |
for (auto i = 0; i < src.size(); i++) { |
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
let selectionEndTimeout = null, | |
event = new Event('selectionEnd'); | |
document.addEventListener('selectionEnd', function (evt/*event*/) { | |
console.log("End selection!") | |
}, false); | |
[ | |
"mouseup", |