Skip to content

Instantly share code, notes, and snippets.

View Valian's full-sized avatar
🔮
Diving deep into Elixir

Jakub Skałecki Valian

🔮
Diving deep into Elixir
View GitHub Profile
@Valian
Valian / app.js
Created May 7, 2024 21:08
Set data-active attributes on LiveView navigation in Phoenix
window.addEventListener("phx:page-loading-start", (_info) => {
Array.from(document.getElementsByTagName("a")).forEach(
(a) => (a.dataset.active = "false")
);
});
window.addEventListener("phx:page-loading-stop", (_info) => {
Array.from(document.getElementsByTagName("a")).forEach(
(a) => {a.dataset.active = (a.href === document.location.href).toString()}
);
@Valian
Valian / usePushEvent.ts
Created August 20, 2024 15:47
usePushEvent - similar to useFetch, but for live_vue library
export function usePushEvent<T extends object, Params extends object = object>(
eventName: string,
defaultValue?: T
) {
const live = useLiveVue();
const isLoading = ref(false);
const isFinished = ref(false);
const response = ref<T | undefined>(defaultValue);
const error = ref<string | null>(null);
const execute = (data: Params) => {
@Valian
Valian / ai_message_sigil.ex
Created February 28, 2025 10:26
Sigils for AI prompts supporting Liquid syntax in Elixir. Requires Solid package.
defmodule Prompts.AIMessageSigils do
@moduledoc """
Provides sigils for creating AI message structures with liquid template validation.
This module includes:
- `~SYSTEM` for system messages
- `~ASSISTANT` for assistant messages
- `~USER` for user messages
Each sigil validates the Liquid template syntax at compile time and returns a
@Valian
Valian / integration_case.ex
Last active November 19, 2025 22:40
a custom test reporter to ExUnit saving HTML report about used LLM calls during integration tests
defmodule Postline.IntegrationCase do
@moduledoc """
This module defines the setup for tests requiring
access to real external services like OpenAI.
Integration tests are meant to test actual integration with
third-party services and are not run by default with `mix test`.
Use `mix test.integration` to run integration tests.
@Valian
Valian / phase_workflow.md
Created October 26, 2025 19:50
Claude command kicking off iterative research - plan - implement workflow heavily utilizing sub-agents

Phase-Based Iterative Workflow

You are an orchestrator for implementing complex features through iterative, phase-based collaboration. You break work into small, manageable phases where each phase is planned, reviewed, implemented, and verified before moving to the next.

CRITICAL: The Plan File is Your Single Source of Truth

The plan file at thoughts/shared/plans/{name}.md is the central collaboration document for the entire feature.

This file must be: