Skip to content

Instantly share code, notes, and snippets.

View andreaseriksson's full-sized avatar

Andreas Eriksson andreaseriksson

View GitHub Profile
@andreaseriksson
andreaseriksson / audit-your-codebase.md
Created August 23, 2026 05:13 — forked from aarondfrancis/audit-your-codebase.md
A read-only, agent-orchestrated codebase audit prompt for data structures, state modeling, algorithms, and ownership.

Audit this entire codebase for materially useful simplifications in its data structures, state representation, control flow, algorithms, and ownership.

This is an audit-only exercise. Do not edit files, run tests, implement recommendations, commit, or push. Read-only inspection commands are allowed.

You are the coordinator. Continue until the complete codebase has been reviewed and the final audit is validated.

  1. Establish the coverage contract

Inspect the repository and inventory every identifiable subsystem.

[
{
"city": "New York",
"description": "Cozy apartment in the heart of the city",
"headline": "Modern apartment with stunning views",
"name": "City View Apartment",
"room": "living room"
},
{
"city": "Los Angeles",
@andreaseriksson
andreaseriksson / convert_to_verified_routes.ex
Last active March 25, 2025 14:01
This is a mix task for converting old Phoenix routes to new verified routes
defmodule Mix.Tasks.ConvertToVerifiedRoutes do
@shortdoc "Fix routes"
use Mix.Task
@regex ~r/(Routes\.)(.*)_(path|url)\(.*?\)/
@web_module MyAppWeb
def run(_) do
Path.wildcard("lib/**/*.*ex")
<.dropdown>
<:toggle>
<svg class="flex-shrink-0 w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-6-3a2 2 0 11-4 0 2 2 0 014 0zm-2 4a5 5 0 00-4.546 2.916A5.986 5.986 0 0010 16a5.986 5.986 0 004.546-2.084A5 5 0 0010 11z" clip-rule="evenodd" />
</svg>
</:toggle>
<ul class="border shadow-xl menu bg-base-100 border-base-200 rounded-box w-52">
<li>
<%= live_redirect "Settings", to: Routes.admin_setting_edit_path(@conn, :edit) %>
</li>
@andreaseriksson
andreaseriksson / _user_menu.html.eex
Created January 27, 2021 07:33
Use phoenix_live_session to communicate bewteen live views
<%= live_render @conn, EcommerceWeb.CartLive %>
@andreaseriksson
andreaseriksson / bootstrap_navbar_in_tailwind.html
Created December 4, 2019 19:14
Create a Bootstrap navbar with Tailwind CSS
<nav class="fixed top-0 right-0 left-0 z-40 flex flex-wrap sm:flex-row items-center justify-between sm:justify-start py-1 px-4 bg-gray-900">
<a class="inline-block py-1 mr-4 text-xl text-gray-100 hover:text-gray-100" href="#">Fixed navbar</a>
<button class="inline-block py-1 px-3 leading-none bg-transparent border border-transparent rounded text-gray-500 border-gray-700 sm:hidden" type="button" data-toggle="collapse" data-target="#navbarCollapse">
<span class="navbar-toggler-icon inline-block w-6 h-6 align-middle bg-center bg-no-repeat"></span>
</button>
<div class="collapse navbar-collapse hidden w-full flex-grow items-center sm:flex sm:w-auto" id="navbarCollapse">
<ul class="flex flex-col pl-0 mb-0 list-none mr-auto sm:flex-row">
<li>
<a class="text-gray-200 hover:text-gray-500 sm:px-2" href="#">Home <span class="sr-only">(current)</span></a>
</li>
@andreaseriksson
andreaseriksson / bootstrap_drop_down_in_tailwind.html
Created December 4, 2019 18:45
Create a Bootstrap drop down with Tailwind CSS
<div class="relative">
<button class="inline-block font-normal text-center px-3 py-2 leading-normal text-base rounded cursor-pointer text-white bg-gray-600 hover:bg-gray-700 dropdown-toggle" type="button" data-toggle="dropdown">
Dropdown button
</button>
<div class="dropdown-menu hidden z-20 float-left py-2 mt-1 text-base text-gray-900 list-none text-left border border-gray-300 bg-white rounded shadow">
<a class="block w-full py-1 px-6 font-normal text-gray-900 bg-transparent border-0 hover:text-gray-900 hover:bg-gray-100" href="#">Action</a>
<a class="block w-full py-1 px-6 font-normal text-gray-900 bg-transparent border-0 hover:text-gray-900 hover:bg-gray-100" href="#">Another action</a>
<a class="block w-full py-1 px-6 font-normal text-gray-900 bg-transparent border-0 hover:text-gray-900 hover:bg-gray-100" href="#">Something else here</a>
</div>
</div>
@andreaseriksson
andreaseriksson / bootstrap_modal_in_tailwind.html
Last active April 17, 2024 14:41
Create a Bootstrap modal with Tailwind CSS
<!-- Button trigger modal -->
<button type="button" class="inline-block font-normal text-center px-3 py-2 leading-normal text-base rounded cursor-pointer text-white bg-blue-600" data-toggle="modal" data-target="#exampleModalTwo">
Launch modal two
</button>
<!-- Modal -->
<div class="modal hidden fixed top-0 left-0 w-full h-full outline-none fade" id="exampleModalTwo" tabindex="-1" role="dialog">
<div class="modal-dialog relative w-auto pointer-events-none max-w-lg my-8 mx-auto px-4 sm:px-0" role="document">
<div class="relative flex flex-col w-full pointer-events-auto bg-white border border-gray-300 rounded-lg">
<div class="flex items-start justify-between p-4 border-b border-gray-300 rounded-t">
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/images/mstile-150x150.png"/>
<TileColor>#0068ac</TileColor>
</tile>
</msapplication>
</browserconfig>
User
|> where([u], not ^device_id in u.match_history)