(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // based on http://msdn.microsoft.com/en-us/magazine/hh335067.aspx | |
| // usage example at bottom | |
| function pso (number_of_dimensions, function_to_optimize, number_of_particles, number_of_iterations, fitness_threshold, inertia_weight, cognitive_weight, social_weight) { | |
| var particles = []; | |
| var swarm_best_position = []; | |
| var swarm_best_fitness = null; | |
| for (var p = 0; p < number_of_particles; p++) { | |
| particles.push({ | |
| particle_position: [], |
| function lens(get, set) { | |
| var f = function (a) { return get(a); }; | |
| f.set = set; | |
| f.mod = function (f, a) { return set(a, f(get(a))); }; | |
| return f; | |
| } | |
| var first = lens( | |
| function (a) { return a[0]; }, | |
| function (a, b) { return [b].concat(a.slice(1)); } |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| /** | |
| * Variant of Avraham Plotnitzky's String.prototype method mixed with the "fast" version | |
| * see: https://sites.google.com/site/abapexamples/javascript/luhn-validation | |
| * @author ShirtlessKirk. Copyright (c) 2012. | |
| * Licensed under WTFPL (http://www.wtfpl.net/txt/copying) | |
| */ | |
| function luhnChk(luhn) { | |
| var len = luhn.length, | |
| mul = 0, |
A pattern for building personal knowledge bases using LLMs. Extended with lessons from building agentmemory 20K+ Stars ⭐️, a persistent memory engine for AI coding agents.
This builds on Andrej Karpathy's original LLM Wiki idea file. Everything in the original still applies. This document adds what we learned running the pattern in production: what breaks at scale, what's missing, and what separates a wiki that stays useful from one that rots.
The core insight is correct: stop re-deriving, start compiling. RAG retrieves and forgets. A wiki accumulates and compounds. The three-layer architecture (raw sources, wiki, schema) works. The operations (ingest, query, lint) cover the basics. If you haven't read the original, start there.