Skip to content

Instantly share code, notes, and snippets.

View bryanmaina's full-sized avatar

Bryan Maina bryanmaina

View GitHub Profile
@bryanmaina
bryanmaina / index.html
Created August 29, 2024 16:33
Run React and ReactFlow cdn
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://esm.sh/@xyflow/[email protected]/dist/style.css?dev">
@bryanmaina
bryanmaina / index.html
Created August 30, 2024 12:04
swapy drag and drop
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://unpkg.com/swapy/dist/swapy.min.js"></script>
@bryanmaina
bryanmaina / thread_safe_closure_cache.rs
Last active January 9, 2025 20:31
Taking Himanshu Kapoor (30 Days of Rust: Day 19 - Closures) tip and making it as complicated as possible because why not.
use std::{
collections::{HashMap, VecDeque},
sync::{Arc, Mutex},
thread,
time::Duration,
};
// Struct using a closure
struct Cacher<T>
where