Skip to content

Instantly share code, notes, and snippets.

View RichardBray's full-sized avatar
😎
Fix bug , drink milkshake, code feature, repeat.

Richard Oliver Bray RichardBray

😎
Fix bug , drink milkshake, code feature, repeat.
View GitHub Profile
@RichardBray
RichardBray / ANALYSIS.md
Created October 1, 2025 09:19
GLM 4.5 analysis of the X algorithm commit c54bec0

X Recommendation Algorithm Repository Analysis

Overview

This document contains the analysis findings of the X recommendation algorithm repository, focusing on the comprehensive rebranding commit that transformed Twitter's terminology to X's branding.

Repository Information

Location: /Users/richardoliverbray/the-algorithm
Repository Type: Git repository

@RichardBray
RichardBray / FINDINGS.md
Created October 1, 2025 09:15
X optimizations for 'For You' page from algo

X "For You" Page Algorithm Optimization Guide

Executive Summary

Based on analysis of X's recommendation algorithm codebase, this document outlines key strategies to improve content visibility on the "For You" timeline. The algorithm uses a sophisticated multi-stage ranking system that considers engagement signals, author credibility, content quality, and user behavior patterns.

Core Algorithm Architecture

1. Multi-Stage Ranking Pipeline

const secret = process.env.SECRET_KEY || "not found";
console.log(`SECRET_KEY: ${secret}`);
return "Result: Code executed successfully";
@RichardBray
RichardBray / tokyonight.yml
Created March 12, 2025 13:08
Tokyo Night Night K9s theme
# -----------------------------------------------------------------------------
# tokyo night
# -----------------------------------------------------------------------------
foreground: &foreground "#a9b1d6"
background: &background "#1a1b26"
current_line: &current_line "#1e202e"
selection: &selection "#515c7e"
comment: &comment "#51597d"
cyan: &cyan "#7dcfff"
@RichardBray
RichardBray / otel-collector-config.yml
Created March 11, 2025 12:36
otel-collector-config.yml
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-config
data:
config.yaml: |
receivers:
otlp:
protocols:
http:
import { Cloudinary, Transformation } from "@cloudinary/url-gen";
import { fill } from "@cloudinary/url-gen/actions/resize";
import { source } from "@cloudinary/url-gen/actions/overlay";
import { image } from "@cloudinary/url-gen/qualifiers/source";
import { Position } from "@cloudinary/url-gen/qualifiers/position";
import { autoGravity, compass } from "@cloudinary/url-gen/qualifiers/gravity";
import { AdvancedImage } from "@cloudinary/react";
import { colorize } from "@cloudinary/url-gen/actions/effect";
function App() {
@RichardBray
RichardBray / decorators.js
Created July 3, 2024 13:47
New JS Decorators
function log(originalMethod: any, _context: any) {
function replacementMethod(this: any, ...args: any[]) {
// const startTime = performance.now();
console.log(`${originalMethod.name} START`);
const result = originalMethod.call(this, ...args);
console.log(`${originalMethod.name} END`);
// const endTime = performance.now();
// console.log(`Method ${originalMethod.name} took ${endTime - startTime} milliseconds`);
return "result: " + result;
}
#!/bin/bash
# This script is a W.I.P
# To use it, just save the file and run sh git-pull.sh
git fetch
git diff HEAD..FETCH_HEAD
read -p "Do you want to merge? (Y/n) " answer
@RichardBray
RichardBray / index.ts
Created February 7, 2024 17:21
Simple Hono Api
import { Hono } from 'hono';
import logger from './utils/logger';
const app = new Hono();
const fakeDB: Array<{ text: string; id: number }> = [];
app.get('/', (c) => c.text('Simple Wishlist API'));
app.get('/wishlist', (c) => {
return c.json([...fakeDB], 200);
{
"items": [
{
"name": "Blue T-Shirt",
"price": 19.99,
"description": "A classic blue t-shirt made from soft cotton.",
"image_url": "https://images.pexels.com/photos/11830106/pexels-photo-11830106.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
},
{
"name": "Red Hoodie",