Skip to content

Instantly share code, notes, and snippets.

View 1hakr's full-sized avatar
🇦🇺
working on new microstartup

Hari 1hakr

🇦🇺
working on new microstartup
View GitHub Profile
@Olanetsoft
Olanetsoft / workflow.md
Created February 25, 2026 17:15
Workflow Orchestration - CLAUDE

Workflow Orchestration

1. Plan Node Default

  • 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.

2. Subagent Strategy

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();
@silverAndroid
silverAndroid / CastMediaItemConverter.kt
Last active November 25, 2025 11:02
How I got subtitles to work with CastPlayer
/** 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"
<?
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
// License: MIT
//
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'
@levelsio
levelsio / log_js_errors.js
Created December 15, 2019 15:56
Log JS errors as a POST to your server
// <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)
@Gioni06
Gioni06 / darkmode.js
Last active November 30, 2022 00:11
Enable Dark mode with css variables and js
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',
@khan-rizwan
khan-rizwan / nearby-coordinates.sql
Created November 29, 2018 16:57 — forked from statickidz/nearby-coordinates.sql
Ordering with SQL by nearest latitude & longitude coordinates (MySQL & SQLite)
---
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
@karlwilbur
karlwilbur / googleapi-example.js
Created November 21, 2018 19:26
Example Google Analytics API Request Using JavaScript/Node.js
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,
@igordata
igordata / server.js
Created November 4, 2018 11:11
How to cahce all pages with next.js
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