Skip to content

Instantly share code, notes, and snippets.

@sabetAI
sabetAI / codex_answers.py
Created August 16, 2021 15:52
Example Prompt for Codex /answers
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Answer.create(
search_model="cushman-codex",
model="davinci-codex",
question="Where is the React component FloatingMenu defined?",
examples_context='''public shouldShow: Exclude<FloatingMenuPluginProps['shouldShow'], null> = ({ state }) => {
const { selection } = state
const { $anchor, empty } = selection
@sabetAI
sabetAI / codex_scrape.py
Created August 16, 2021 15:46
Scraping Files for Upload to Codex
import os
from argparse import ArgumentParser
import openai
import jsonlines
openai.api_key = os.environ['OPENAI_API_KEY']
# read all typescript files in all subdirectories
def get_all_files(dir, ext):
all_files = []
@sabetAI
sabetAI / color.ts
Last active August 10, 2021 22:52
TipTap Color Extension
import { Extension } from "@tiptap/core";
import "@tiptap/extension-text-style";
type ColorOptions = {
types: string[];
};
declare module "@tiptap/core" {
interface Commands<ReturnType> {
color: {
@sabetAI
sabetAI / gist:db1f911437df968ba8023cae99d65d0d
Last active June 9, 2021 16:52
Refactoring InputDecoration does not reproduce behaviour
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@sabetAI
sabetAI / .dart
Created March 6, 2021 20:18
IgnorePointer works with Stacked AppBars
import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {