Skip to content

Instantly share code, notes, and snippets.

View michaelaflores's full-sized avatar

Michael Flores michaelaflores

View GitHub Profile
# Agent-friendly architecture
Dune assumes many contributors arrive with a narrow prompt, a few nearby files, and no complete model of Sand. the locally obvious change the globally correct change. Unsafe shortcuts fail with an error that names the supporte
This page defines the contributor context model and the architecture choices that keep repeated local edits from
## Contract
A coding agent usually optimizes for what fits in its context:
- copy the nearest working pattern;
- edit the file already open;
/* eslint-disable no-restricted-globals */
// This service worker can be customized!
// See https://developers.google.com/web/tools/workbox/modules
// for the list of available Workbox modules, or add any other
// code you'd like.
// You can also remove this file if you'd prefer not to use a
// service worker, and the Workbox build step will be skipped.
import { clientsClaim } from "workbox-core";
@michaelaflores
michaelaflores / Image preloader
Created April 22, 2022 02:03
Put images in the browser cache
import getLocation from "./preloadImages/locationApi";
const LOCAL_STORAGE_PREFIX = "imageQueue";
// This queue holds information about images we want to load, it will be the location object from the location API.
// It does not hold the image itself. It is mutated.
let queue = [];
// Default export.
// Fills the image queue with data, and calls utility functions to load their sources.
@michaelaflores
michaelaflores / unregisterServiceWorkers.js
Created April 17, 2022 08:36 — forked from mrienstra/unregisterServiceWorkers.js
Unregister service workers, verbose
navigator.serviceWorker.getRegistrations().then(function (registrations) {
if (!registrations.length) {
console.log('No serviceWorker registrations found.')
return
}
for(let registration of registrations) {
registration.unregister().then(function (boolean) {
console.log(
(boolean ? 'Successfully unregistered' : 'Failed to unregister'), 'ServiceWorkerRegistration\n' +
(registration.installing ? ' .installing.scriptURL = ' + registration.installing.scriptURL + '\n' : '') +
@michaelaflores
michaelaflores / index.html
Created April 27, 2021 15:04
Sample Chrome extension index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="A window to anywhere in the world, just a tab away." />
<meta http-equiv="Content-Security-Policy" content="script-src * 'unsafe-eval' 'unsafe-inline';" />
@michaelaflores
michaelaflores / manifest.json
Last active April 27, 2021 15:01
Sample Chrome extension manifest
{
"name": "Passport - see the world on your new tab page",
"description": "A window to anywhere in the world, just a tab away.",
"version": "1.0.2",
"manifest_version": 2,
"chrome_url_overrides": {
"newtab": "./index.html"
},
"browser_action": {
"default_icon": "./favicon-32x32.png"
const yourContentfulSpace = ""
// Retrieve an image at 50% quality
yourContentfulSpace/mycat.jpg?&q=50
// Retrieve an image as WebP format at 50% quality
yourContentfulSpace/mycat.jpg?&fm=webp&q=50
@michaelaflores
michaelaflores / cloudSettings
Created October 20, 2019 21:59
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-10-20T21:59:12.006Z","extensionVersion":"v3.4.3"}