Skip to content

Instantly share code, notes, and snippets.

@harrytormey
harrytormey / iterate_data.py
Created March 13, 2024 20:52
How to iterate over data in parquet file from hugging face, example uses SWEBench data.
import pandas as pd
df = pd.read_parquet("./test-00000-of-00001-dc7762b94638c186.parquet")
# Filter the DataFrame for entries from the Django repo
django_entries = df[df["repo"].str.contains("Django", case=False)]
if not django_entries.empty:
for index, row in django_entries.iterrows():
Loading files from /Users/harrytormey/Documents/Code/next-realworld-example-app. Using model gpt3!
planOne {
filePath: '/Users/harrytormey/Documents/Code/next-realworld-example-app/pages/_app.tsx',
loggingSteps: [ 'Track page views in the _app.tsx file.' ]
}
Printing res
{
text: 'import Head from "next/head";\n' +
'import React, { useEffect } from "react";\n' +
'\n' +
To track user interactions and page views within the web application, you would need to modify the following files:
1. `/Users/harrytormey/Documents/Code/next-realworld-example-app/pages/index.tsx`:
- Track page views of the home page.
- Track user interactions with the banner, main view, and popular tags components.
2. `/Users/harrytormey/Documents/Code/next-realworld-example-app/components/home/Tags.tsx`:
- Track user interactions with the tags displayed on the home page.
- Track page context updates when a tag is clicked.
@harrytormey
harrytormey / analysisOutput.json
Created June 8, 2023 01:37
LLMAnalysisOfNextJSSampleCode.json
{
"/Users/harrytormey/Documents/Code/next-realworld-example-app/next-env.d.ts":{
"fileName":"next-env.d.ts",
"analysis":"This code is a reference to the Next.js types and global types in a TypeScript project. It is located in the 'next-env.d.ts' file in the specified directory.",
"filePath":"/Users/harrytormey/Documents/Code/next-realworld-example-app/next-env.d.ts"
},
"/Users/harrytormey/Documents/Code/next-realworld-example-app/components/common/ErrorMessage.tsx":{
"fileName":"ErrorMessage.tsx",
"analysis":"This code defines a React component called ErrorMessage that takes in a message prop and displays it in a styled error container. It is used in a Next.js project and is located in the components/common directory.",
"filePath":"/Users/harrytormey/Documents/Code/next-realworld-example-app/components/common/ErrorMessage.tsx"
{"/Users/harrytormey/Documents/Code/next-realworld-example-app/next-env.d.ts":{"fileName":"next-env.d.ts","analysis":"This code is a reference to the Next.js types and global types in a TypeScript project. It is located in the 'next-env.d.ts' file in the specified directory.","filePath":"/Users/harrytormey/Documents/Code/next-realworld-example-app/next-env.d.ts"},"/Users/harrytormey/Documents/Code/next-realworld-example-app/components/common/Layout.tsx":{"fileName":"Layout.tsx","analysis":"This code defines a layout component in a TypeScript Next.js project that includes a Navbar and Footer component and renders any child components passed to it. Its purpose is to provide a consistent layout for pages throughout the application.","filePath":"/Users/harrytormey/Documents/Code/next-realworld-example-app/components/common/Layout.tsx"},"/Users/harrytormey/Documents/Code/next-realworld-example-app/components/common/ErrorMessage.tsx":{"fileName":"ErrorMessage.tsx","analysis":"This code defines a React component cal
@harrytormey
harrytormey / amplitude.js
Created June 5, 2023 17:54
Fist crappy pass at amplitude logging for a nextjs project
import amplitude from 'amplitude-js';
import { useRouter } from 'next/router';
// TODO: Don't hardcode this, load this for prod/dev using dotenv. i.e
//const API_KEY =
// process.env.NODE_ENV === 'production'
// ? "PRODUCTION_API_KEY_HERE"
// : "DEV_API_KEY_HERE";
const API_KEY = 'ADD MY KEY';