Go to the egghead website, i.e. Building a React.js App
run
$.each($('h4 a'), function(index, video){
console.log(video.href);
});Go to the egghead website, i.e. Building a React.js App
run
$.each($('h4 a'), function(index, video){
console.log(video.href);
});Service Worker - offline support for the web
Progressive apps - high-res icon, splash screen, no URL bar, etc.
| function waitForElement(selector) { | |
| return new Promise(function(resolve, reject) { | |
| var element = document.querySelector(selector); | |
| if(element) { | |
| resolve(element); | |
| return; | |
| } | |
| var observer = new MutationObserver(function(mutations) { |
| addEventListener('fetch', function (event) { | |
| event.respondWith(handleRequest(event.request)); | |
| }); | |
| // Allowed domain origins | |
| var allowed = ['http://localhost:8000', 'https://your-website.com']; | |
| /** | |
| * Respond to the request | |
| * @param {Request} request |
| (() => { | |
| let count = 0; | |
| function getAllButtons() { | |
| return document.querySelectorAll('button.is-following') || []; | |
| } | |
| async function unfollowAll() { | |
| const buttons = getAllButtons(); |
| // Note: this gist is a part of this OSS project that I'm currently working on: https://github.com/steven-tey/dub | |
| export default async function getTitleFromUrl (url: string) { | |
| const controller = new AbortController(); | |
| const timeoutId = setTimeout(() => controller.abort(), 2000); // timeout if it takes longer than 2 seconds | |
| const title = await fetch(url, { signal: controller.signal }) | |
| .then((res) => { | |
| clearTimeout(timeoutId); | |
| return res.text(); | |
| }) |
In the Generative AI Age your ability to generate prompts is your ability to generate results.
Claude 3.5 Sonnet and o1 series models are recommended for meta prompting.
Replace {{user-input}} with your own input to generate prompts.
Use mp_*.txt as example user-inputs to see how to generate high quality prompts.
A GitHub Actions workflow that uses Claude Opus (via AWS Bedrock) to automatically review pull requests with inline comments.
A pattern for building personal knowledge bases using LLMs.
This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.
Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.