Skip to content

Instantly share code, notes, and snippets.

View lishine's full-sized avatar
🎯
Focusing

Pavel Ravits lishine

🎯
Focusing
View GitHub Profile
@jdegenstein
jdegenstein / build123d-OCP.code-snippets
Last active November 14, 2024 21:14
VSCode Snippet for build123d + OCP CAD Viewer modeling / speed running
{
// build123d CodeCAD speedmodeling snippet by Jern
//
// This was specifically designed for use with TooTallToby's modeling challenges, but applicable for
// all CodeCAD modeling, but customize as desired for your own needs. This provides:
// 1. A file template that reduces the time necessary to "just start coding/modeling"
// 2. Shortcuts like "?ebds + TAB" that creates a BuildSketch + extrude block
//
// recommended to bind "Snippets: Fill file with Snippet" to e.g. CTRL + ALT + N
// recommended to bind "Jupyter: Restart Kernel" to e.g. CTRL + ALT + /
@Aslemammad
Aslemammad / mutableSource.tsx
Last active June 1, 2024 03:34
Consistent version of useMutableSource.
// Consistent version of `useMutableSource`, Inspired by https://github.com/pmndrs/valtio/blob/master/src/useMutableSource.ts
import { useEffect, useRef, useState } from 'react';
const TARGET = Symbol('target');
const GET_VERSION = Symbol('getVersion');
export type Source<TargetType extends any, VersionType extends any> = {
[TARGET]: TargetType;
[GET_VERSION]: (target: TargetType) => VersionType;
};