Skip to content

Instantly share code, notes, and snippets.

View qant's full-sized avatar
💫
Permanent study state

Anton qant

💫
Permanent study state
View GitHub Profile
@qant
qant / llm-wiki.md
Created April 19, 2026 12:38 — forked from karpathy/llm-wiki.md
llm-wiki

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@qant
qant / function.php
Created July 27, 2023 06:57 — forked from szelag-michal/function.php
Woocommerce Mini Cart
//Override woocommerce product categories widgets
add_action( 'widgets_init', 'floweb_override_woocommerce_widgets', 15 );
function floweb_override_woocommerce_widgets() {
// Ensure our parent class exists to avoid fatal error
if ( class_exists( 'WC_Widget_Cart' ) ) {
unregister_widget( 'WC_Widget_Cart' );
require get_template_directory() . '/functions/custom-widgets/floweb-class-wc-widget-cart.php';
register_widget( 'Floweb_WC_Widget_Cart' );
}
}
@qant
qant / 01_enhanced_ecommerce_plugin.js
Created July 5, 2023 18:39 — forked from OrenBochman/01_enhanced_ecommerce_plugin.js
Enhanced ecommerce snippets in universal analytics
//This command must occur after you create your tracker object and before you use any of the enhanced ecommerce specific functionality.
ga('require', 'ec');
@qant
qant / wc-rest-api-products-images.php
Created March 28, 2023 08:00 — forked from seb86/wc-rest-api-products-images.php
WooCommerce REST API (Products) - Get the images for a product or product variation and returns all image sizes.
<?php
if ( ! function_exists( 'wc_rest_get_product_images' ) ) {
add_filter( 'woocommerce_rest_prepare_product_object', 'wc_rest_get_product_images', 10, 2 );
/**
* Get the images for a product or product variation
* and returns all image sizes.
*
* @param WP_REST_Request $request Request object.
* @param WC_Product|WC_Product_Variation $product Product instance.
@qant
qant / filter.php
Created May 7, 2022 07:13 — forked from cfxd/filter.php
Efficient Responsive Images in WordPress. See https://cfxdesign.com/efficient-responsive-images-in-wordpress
<?php
/*
* THE FILTER
*
*/
function custom_responsive_image_sizes($sizes, $img_name, $attachment_id) {
$sizes = wp_get_attachment_image_sizes($attachment_id, 'original');
$meta = wp_get_attachment_metadata($attachment_id);
$width = $meta['width'];
@qant
qant / woocommerce-popular-products.php
Created March 24, 2022 08:23 — forked from aslamdoctor/woocommerce-popular-products.php
Woocommerce : Get popular products using wp_query
@qant
qant / lenura_empty_cart_before_add.php
Created May 29, 2021 11:48 — forked from viniciusrtf/lenura_empty_cart_before_add.php
WooCommerce Hook: Empty cart before adding a new product to cart WITHOUT throwing woocommerce_cart_is_empty
<?php
/**
* Hook: Empty cart before adding a new product to cart WITHOUT throwing woocommerce_cart_is_empty
*/
add_action ('woocommerce_add_to_cart', 'lenura_empty_cart_before_add', 0);
function lenura_empty_cart_before_add() {
global $woocommerce;
// Get 'product_id' and 'quantity' for the current woocommerce_add_to_cart operation
@qant
qant / woo-events.js
Created May 29, 2021 08:51 — forked from bagerathan/woo-events.js
Woocommerce Javascript events #woocommerce
//Woocommerce Checkout JS events
$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
//Woocommerce cart page JS events
$( document.body ).trigger( 'wc_cart_emptied' );
$( document.body ).trigger( 'update_checkout' );
@qant
qant / curl_vs_getheaders.php
Created April 16, 2021 10:56
cURL vs get_headers() Speed Test
<?php
// Get headers for 100 unique random domains with get_headers() and cURL to determine which is faster.
/*
TL;DR -> cURL is significantly faster.
get_headers (GET) vs cURL:
Execution time : 139.95884609222 seconds
Execution time : 65.998840093613 seconds
@qant
qant / google_translate.html
Created April 1, 2021 09:53 — forked from carolineschnapp/google_translate.html
Google Translate Embed Code
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>