Skip to content

Instantly share code, notes, and snippets.

View jsmithdev's full-sized avatar
🏗️
building things

Jamie Smith jsmithdev

🏗️
building things
View GitHub Profile
@jsmithdev
jsmithdev / llm-wiki.md
Created October 29, 2026 04:14 — 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.

@jsmithdev
jsmithdev / ExampleRecursiveSortSum.js
Created October 24, 2024 13:03
An example of recursively sorting then summing chained data structures
const data = [
{ Id: 'a0wcn0000006DxTEST0', SBQQ__RequiredBy__c: '', SBQQ__PartnerTotal__c: 0, Children_Total__c: 0, },
{ Id: 'a0wcn0000006DxTEST1', SBQQ__RequiredBy__c: 'a0wcn0000006DxTEST0', SBQQ__PartnerTotal__c: 1, Children_Total__c: 0, },
{ Id: 'a0wcn0000006DxTEST4', SBQQ__RequiredBy__c: 'a0wcn0000006DxTEST3', SBQQ__PartnerTotal__c: 1, Children_Total__c: 0, },
{ Id: 'a0wcn0000006DxTEST2', SBQQ__RequiredBy__c: 'a0wcn0000006DxTEST1', SBQQ__PartnerTotal__c: 1, Children_Total__c: 0, },
{ Id: 'a0wcn0000006DxTEST3', SBQQ__RequiredBy__c: 'a0wcn0000006DxTEST2', SBQQ__PartnerTotal__c: 1, Children_Total__c: 0, },
]
/* Start sort */
@jsmithdev
jsmithdev / SOQL Queries.sql
Created January 24, 2023 02:43 — forked from sholloway/SOQL Queries.sql
Useful SOQL queries for exploring a Salesforce org.
--------------------------------------------------------------------
-- Queries related to distribution of metadata.
-- Find the number of users per profile.
SELECT count(id), Profile.name
FROM User
WHERE User.IsActive = true
GROUP BY Profile.name
-- Find the distribution of Apex classes per namespace.
select count(id), NameSpacePrefix
@jsmithdev
jsmithdev / conky.config
Created January 22, 2023 14:06
Conky config: 16 core, amdgpu
alignment top_left
background true
border_width 1
color1 e100ff
color2 D1E7D1
color3 FF0000
color4 FFFFFF
cpu_avg_samples 2
default_color D1E7D1
default_outline_color white
@jsmithdev
jsmithdev / RegexWC.js
Last active July 28, 2022 23:42
Web Components / LWC Regular Expressions
/**
* @description Matches name of component - "ui-comp" from `<ui-comp class="ok">EVERYTHING</ui-comp>`
* @return {Array} array of matches
* @demo regexr.com/6qp3v
**/
export function nameUse(s) {
return s.match(new RegExp(/(?<=<)((\w*)(-\w*))(-\w*)*/, 'g'));
}
/**
function dbl(x){
return x+x
}
Array.from(Array(30).keys())
.reduce((acc, curr, index) => {
acc = acc === 0 ? .01 : dbl(acc)
console.log('day ', index+1, ': $', acc)
return acc
}, 0)
@jsmithdev
jsmithdev / getRandomAddress.cls
Created September 28, 2021 14:01
Apex method to get a pseudo random address
/**
* get a pseudo random address
* @param {Integer} val - number to decide what address to return
* @return {String} - address
*/
public static String getRandomAddress(Integer val) {
Integer i = Integer.valueOf(String.valueOf(val).right(1));// get last num; 3, 223, 113 would be 3;
if(i == 0){ return '61 North Avenue NW, Atlanta, GA, 30308'; }
if(i == 1){ return '210 Peachtree St NW, Atlanta, GA, 30303'; }
if(i == 2){ return '12 Cobb Pkwy SE, Marietta, GA, 30062'; }
@jsmithdev
jsmithdev / remove console log webpack.md
Created September 21, 2021 12:54 — forked from rupeshtiwari/remove console log webpack.md
remove console.log & comments from code webpack

Remove Console Log From Prod Bundle using Webpack

This will help you to remove console.log and comments from typescript or javascript files using webpack 4

Install uglifyjs-webpack-plugin

webpack remove console.log

npm i npm install uglifyjs-webpack-plugin --save-dev

create bs-module-app\webpack\webpack-optimization.config.js

@jsmithdev
jsmithdev / lwc-swipe.js
Created July 8, 2021 23:10
swipe actions in an lwc app
renderedCallback() {
// swipe to close
this.template
.querySelector('div.app')
.addEventListener(
'touchstart',
this.handleTouchStart.bind(this),
false
);
@jsmithdev
jsmithdev / xmlToJson.js
Last active September 1, 2021 03:47 — forked from chinchang/xmlToJson.js
Function to convert XML to JSON
/*
Usage:
1. If you have an XML file URL:
const response = await fetch('file_url');
const xmlString = await response.text();
var XmlNode = new DOMParser().parseFromString(xmlString, 'text/xml');
xmlToJson(XmlNode);