- Enter plan mode for ANY non-trivial task (3+ steps or architectural decisions).
- If something goes sideways, STOP and re-plan immediately—don't keep pushing.
- Use plan mode for verification steps, not just building.
- Write detailed specs upfront to reduce ambiguity.
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
| async function listNotebooks() { | |
| const authParams = await getAuthParams(); | |
| const { url: n, headers: r, body: o } = await createBatchExecuteRequest(authParams); | |
| const response = await fetch(n.toString(), { | |
| method: "POST", | |
| headers: r, | |
| body: o | |
| }); | |
| const text = await response.text(); |
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
| /** Copied [DefaultMediaItemConverter] but with subtitle support. */ | |
| @OptIn(UnstableApi::class) | |
| class CastMediaItemConverter : MediaItemConverter { | |
| private val KEY_MEDIA_ITEM = "mediaItem" | |
| private val KEY_PLAYER_CONFIG = "exoPlayerConfig" | |
| private val KEY_MEDIA_ID = "mediaId" | |
| private val KEY_URI = "uri" | |
| private val KEY_TITLE = "title" | |
| private val KEY_MIME_TYPE = "mimeType" | |
| private val KEY_DRM_CONFIGURATION = "drmConfiguration" |
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
| <? | |
| // | |
| // AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio) | |
| // | |
| // File: twitterFollowerCuratorBot.php | |
| // | |
| // Created: May 2021 | |
| // License: MIT | |
| // |
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
| async function checkForAdBlocker() { | |
| let Blocked; | |
| async function Request() { | |
| try { | |
| return fetch( | |
| new Request( | |
| "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js", { | |
| method: 'HEAD', | |
| mode: 'no-cors' |
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
| // <log errors to server> | |
| window.onerror = function (messageOrEvent, source, lineno, colno, error) { | |
| try { | |
| console.log({ | |
| //error message(string).Available as event (sic!) in HTML onerror = "" handler. | |
| messageOrEvent: messageOrEvent, | |
| //URL of the script where the error was raised(string) | |
| source: source, | |
| //Line number where error was raised(number) |
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 activateDarkMode() { | |
| const rootElement = document.querySelector(':root') | |
| const darkTheme = { | |
| '--background-color': '#1e1e1e', | |
| '--primary-color': '#157efb', | |
| '--font-color': '#dedede', | |
| '--subtle-primary-color': '#151513', | |
| '--block-background-color': '#323232', | |
| '--menu-item-color': '#dedede', | |
| '--menu-item-hover-color': '#157efb', |
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
| --- | |
| METHOD 1 | |
| This should roughly sort the items on distance in MySQL, and should work in SQLite. | |
| If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance. | |
| --- | |
| SELECT * | |
| FROM table | |
| ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC |
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 config from './config.js' | |
| import { google } from 'googleapis' | |
| const scopes = ['https://www.googleapis.com/auth/analytics.readonly'] | |
| const jwtClient = new google.auth.JWT(config.clientEmail, null, config.privateKey, scopes) | |
| async function doTheThings() { | |
| await jwtClient.authorize() | |
| let response = await google.analytics('v3').data.realtime.get({ | |
| 'auth': jwtClient, |
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 express = require('express'); | |
| const next = require('next'); | |
| const LRUCache = require('lru-cache'); | |
| const port = parseInt(process.env.PORT, 10) || 3000; | |
| const dev = process.env.NODE_ENV !== 'production'; | |
| const app = next({dev}); | |
| const handle = app.getRequestHandler(); | |
| // This is where we cache our rendered HTML pages |
NewerOlder