Skip to content

Instantly share code, notes, and snippets.

@pbakaus
pbakaus / dev-auth-shortcuts.md
Last active April 4, 2026 13:36
Dev Auth Shortcuts - Stop AI agents from fumbling with login forms

Dev Auth Shortcuts for AI Browser Automation

Stop AI agents from fumbling with login forms. This prompt helps you create development-only endpoints that let browser automation tools authenticate instantly.

The Problem

When using AI agents with browser automation (agent-browser, Playwright MCP, Claude's computer use, Cursor's browser mode), they hit login walls and waste time filling out forms, handling redirects, and losing session state.

The Solution

@brainlid
brainlid / index.ex
Last active March 3, 2025 12:55
Example files for a LiveView blog post that starts an async process using Phoenix Async Assigns to perform work and send message back to the LiveView. https://fly.io/phoenix-files/abusing-liveview-new-async-assigns-feature/
defmodule MyAppyWeb.TaskTestLive.Index do
use MyAppyWeb, :live_view
require Logger
alias Phoenix.LiveView.AsyncResult
@impl true
def mount(_params, _session, socket) do
socket =
socket
|> assign(:async_result, %AsyncResult{})
@HugeLetters
HugeLetters / router-gen.ts
Last active September 6, 2024 01:46
SvelteKIt type-safe router
import { watch } from 'chokidar';
import { writeFile } from 'fs/promises';
import { glob } from 'glob';
import { format } from 'prettier';
const pageGlobMatcher = './src/routes/**/+page?(@)*.svelte';
export default async function generateRoutes() {
const paths = await getPaths();
const routes = paths.map(parsePath);
@plicjo
plicjo / simple_s3_upload.ex
Last active June 6, 2025 00:45
LiveView Uploads to S3
defmodule SimpleS3Upload do
@moduledoc """
Dependency-free S3 Form Upload using HTTP POST sigv4
https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html
"""
@doc """
Signs a form upload.
The configuration is a map which must contain the following keys:
* `:region` - The AWS region, such as "us-east-1"
@romenigld
romenigld / elixir.json
Created July 14, 2022 11:25
code snippets for the elixir.json
{
// Place your snippets for elixir here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@mcrumm
mcrumm / phx_sqlite_fly_launch.md
Last active January 17, 2026 15:23
Phoenix + SQLite Deployment tips

Deploying to Fly.io with SQLite

Deploying a Phoenix app to Fly.io is a breeze...is what everyone kept telling me. In fairness, I imagine the process would have been breezier had I just used postgres, but all the sqlite and litestream talk has been far too intriguing to ignore. "Wait", you say. "It is just a flat file. How much harder can it be?"

It is easy to make something harder than it should be. It is hard to take something complex and make it truly simple. flyctl launch does an amazing job at providing a simple interface to the utterly complex task of generating deployment resources, especially now that we are living in a containerd (erm, firecracker) world.

This gist is for anyone who, like me, thinks they know better than to read all of the documentation and therefore necessari

#!/bin/bash
set -e
PROJECT_NAME=$1
main() {
display_logo
init_project
choose_branch
@maheshgawali
maheshgawali / bb_pr_checker.py
Created August 10, 2018 09:01
simple python script to check if a PR exists for the current branch in bitbucket pipeline, execute bitbucket pipelines only if a PR is created for a branch
#!/usr/bin/env python3
import requests
import json
import argparse
PAGE_LENGTH = '50'
PR_STATE = 'OPEN'
module IncrementAndDecrement
def increment(&block)
matcher = change(&block).by(1)
RSpec::Matchers::AliasedMatcher.new(matcher, lambda do |desc|
desc.gsub("changed", "incremented").gsub("change", "increment")
end)
end
def decrement(&block)
matcher = change(&block).by(-1)