Skip to content

Instantly share code, notes, and snippets.

View disler's full-sized avatar

IndyDevDan disler

View GitHub Profile
@disler
disler / machine.js
Last active July 5, 2020 15:32
Generated by XState Viz: https://xstate.js.org/viz
const makeTradeInvalid = assign((c, e) => ({valid_trade: false}))
const fetchMachine = Machine({
id: 'trade',
initial: 'begin_trade',
context: {
valid_trade: true,
},
states: {
begin_trade: {
on: {
@disler
disler / notion_create_page_add_text.py
Created May 14, 2023 14:23
Notion - create a page then write content to the page
from notion_client import Client
from pprint import pprint
notion_token = '<your token>'
notion_page_id = '<your page id>'
def create_page(client, parent_page_id, title):
new_page = client.pages.create(
parent={
@disler
disler / main.py
Last active November 29, 2023 04:30
vueGPT: Automatically Generate Vue 3 <script setup lang='ts'> components like a boss.
from vueGPT import prompt, make_client
from dotenv import load_dotenv
# load .env file
load_dotenv()
# get openai api key
OPENAI_API_KEY = environ.get('OPENAI_API_KEY')
@disler
disler / vue.code-snippets
Last active November 4, 2023 11:32
My Most Used, Biggest Time Saving Vue.js Code Snippets
{
"Generate a new vue.js <script setup> component": {
"scope": "javascript,typescript,vue",
"prefix": "vuebn",
"body": [
"<template>",
"\t<div class=\"${TM_FILENAME_BASE/(.*)/${1:/downcase}/}-w\">",
"\t\t${TM_FILENAME_BASE}.vue$0",
"\t</div>",
"</template>",
@disler
disler / component-prompt.txt
Created July 30, 2023 19:20
Front-End Component Prompt With Role, Purpose, Requirements and Memory Techniques
You're a Senior Vue.js Front-end Engineer that mentored directly with Evan You, creator of Vue.js.
You have a new project that requires you to build a new component.
The component has the following requirements:
- Create a Carousel component with a sliding animation so that when the user clicks 'next' or 'previous' the user visually sees a swipe animation.
- Don't use the Vue.js Transition wrapper. Instead, use the view width css property to create the animation and base the scroll position on the current index of the carousel.
- Horizontally slide the components from 1 to 2 of 'next' is clicked and from 2 to 1 if 'previous' is clicked.
- Within the Carousel component place 3 divs which represent 3 slides.
@disler
disler / llm.py
Last active May 1, 2024 20:45
Python LLM Starter Module
"""
Purpose:
Interact with the UPDATED OpenAI API Supports 1.2.3+
Provide supporting prompt engineering functions.
"""
"""
Purpose:
Interact with the OpenAI API.
Provide supporting prompt engineering functions.
"""
@disler
disler / prompt-generate-python-class.txt
Last active May 1, 2024 20:43
Python Class Generator Prompt
Create a python class that enables <objective>. I need the following FUNCTION support.
FUNCTION
__init__()
func1()
func2(with_param)
func3(with_param) - explanation of function
@disler
disler / the-fishermans-prompt
Created October 2, 2023 12:50
Fisherman's Prompt
I'm a [your level] [profession] and I want to learn [topic] so I can [objective]. Follow the RULES below to generate a comprehensive yet concise mini-course for rapid learning. The course should contain chapters that teach me about these SUB_TOPICS. Make sure the chapters fit my level, profession and topic. Ask for clarification if you need more information about my knowledge.
SUB_TOPICS
- [topic 1]
- [topic 2]
- [topic 3]
RULES
- Use concrete examples to explain every concept
- Use emojis to add expression
@disler
disler / standards_for_true_ai_coding_assistants.md
Created January 21, 2024 16:30
Standards For True AI Coding Assistants

What is an AI Coding Assistant?

If the coding assistant can't run ITERATIVE CRUD on ALL of your code, it's not a True AI Coding Assistant (TACA)

Standards for TRUE AI Coding Assistants

  1. Must work on existing codebases
  2. Must have a file context mechanism
  3. Must be iteratively controllable
@disler
disler / README.md
Created March 31, 2024 14:34
Use these Prompt Chains to build HIGH QUALITY AI Agents (Agentic Building Blocks)

Setup

  1. Create a new directory with these three files (requirements.txt, main.py, README.md)
  2. python -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python main.py
  6. Update main() to run the example prompt chains