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
| const os = require("os"); | |
| const path = require("path"); | |
| const fs = require("fs/promises"); | |
| const OAUTH_FILE = path.join(os.homedir(), ".gemini", "oauth_creds.json"); | |
| // Type enum equivalent in JavaScript | |
| const Type = { | |
| TYPE_UNSPECIFIED: "TYPE_UNSPECIFIED", | |
| STRING: "STRING", |
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 <stdio.h> | |
| #include <unistd.h> | |
| #define GRID_COLS 20 | |
| #define GRID_ROWS 20 | |
| #define GRID_CELLS (GRID_COLS*GRID_ROWS) | |
| #define ALIVE '*' | |
| #define DEAD '.' | |
| /* Translate the specified x,y grid point into the index in |
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
| import os | |
| from google import genai | |
| from google.genai import types | |
| client = genai.Client(api_key=os.getenv("GEMINI_API_KEY","xxx")) | |
| # Repalce with the youtube url you want to analyze | |
| youtube_url = "https://www.youtube.com/watch?v=RDOMKIw1aF4" | |
| # Prompt to analyze and summarize the Youtube Video |
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
| import subprocess | |
| import dspy | |
| ### Note this code is not tested, and likely includes errors that need to be refined. | |
| class IterativeCodeRefinement(dspy.Module): | |
| def __init__(self): | |
| super().__init__() | |
| self.generate_pseudocode = dspy.ChainOfThought("task -> pseudocode") |
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
| import ast | |
| import inspect | |
| import dspy | |
| from typing import Type | |
| from pydantic import BaseModel | |
| class User(BaseModel): | |
| name: str |
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
| import ast | |
| import logging | |
| import inspect | |
| from typing import Type, TypeVar | |
| from dspy import Assert, Module, ChainOfThought, Signature, InputField, OutputField | |
| from pydantic import BaseModel, ValidationError | |
| logger = logging.getLogger(__name__) | |
| logger.setLevel(logging.ERROR) |
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
| function escapeNewLines(str: string) { | |
| return str.replace(/\n/g, '\\n'); | |
| } | |
| function fixOpenAiNewLineResponse(str: string) { | |
| return str | |
| .split('"') | |
| .map((chunk, index) => { | |
| // Only replace \n inside the JSON string values, which are in every other index after splitting by " | |
| if (index % 2 === 1) { |
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
| app.post("signin/email", async (c) => { | |
| const env = c.env as Env; | |
| const { email } = formSchema.parse(await c.req.json()); | |
| const token = await generateEmailVerificationToken(email, env); | |
| try { | |
| const data = await sendEmailVerificationLink(email, token, env); |
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
| import DB from './DB' | |
| describe('DB', () => { | |
| let db: DB | |
| const data = { name: 'Tom Cook', type: ['person', 'CEO'] } | |
| beforeEach(() => { | |
| db = new DB() | |
| db.addNode('1', { name: 'Apple Computer Company', type: ['company', 'start-up'], founded: 'April 1, 1976' }) |
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
| const sveltePreprocess = require('svelte-preprocess'); | |
| module.exports = { | |
| // Consult https://github.com/sveltejs/svelte-preprocess | |
| // for more information about preprocessors | |
| preprocess: sveltePreprocess({ | |
| // WARNING: Mandatory for the postcss config (postcss.config.js) and Tailwind to be loaded | |
| postcss: {}, // <------ this is the important part :) | |
| }), // can pass the options here using { }, but we use svelte.preprocess.config.js for that (gives us more context) | |
| }; |
NewerOlder