Skip to content

Instantly share code, notes, and snippets.

@safx
safx / Lensy.swift
Created February 26, 2016 01:27
Lensy separates LensType into (non-failable) LensType and FailableLensType
//
// Lensy.swift
// Lensy
//
// Created by Safx Developer on 2016/02/12.
// Copyright © 2016 Safx Developers. All rights reserved.
//
// MARK: - Lenses protocols
@safx
safx / App.tsx
Last active May 4, 2023 09:37
React Router Redirects (Auth) Example with React Context and TypeScript
import * as React from 'react';
import { BrowserRouter as Router, Link, Redirect, Route, RouteComponentProps, withRouter } from 'react-router-dom';
const UserAuthContext = React.createContext({
authenticated: false,
setAuthenticated: (_:boolean) => {}
});
const AuthExample = () => (
<Router>
@safx
safx / main.rs
Created October 26, 2023 12:19
Fine-grained reactive system: https://www.youtube.com/watch?v=GWB3vTWeLd4
use std::any::Any;
use std::cell::{Cell, RefCell};
use std::collections::{HashMap, HashSet};
use std::marker::PhantomData;
use web_sys::{console, window};
use wasm_bindgen::prelude::{Closure, JsCast};
#[derive(Default)]
struct Runtime {
signal_values: RefCell<Vec<Box<RefCell<dyn Any>>>>,
#!/bin/bash
# Claude Session Selector - Interactive session selection and restore
set -euo pipefail
# Get the project directory for current path
PROJECT_DIR="$HOME/.claude/projects"
CURRENT_DIR=$(pwd)
PROJECT_PATH=$(echo "$CURRENT_DIR" | sed -Ee 's/[_\/]/-/g')
SESSION_DIR="$PROJECT_DIR/$PROJECT_PATH"