Skip to content

Instantly share code, notes, and snippets.

@jmatsushita
jmatsushita / ExpoSQLiteNext.ts
Last active February 5, 2024 11:56
enabling web for expo-sqlite (with async-mutex)
import { NativeDatabase, SQLiteOpenOptions } from "./NativeDatabase";
import {
NativeStatement,
SQLiteAnyDatabase,
SQLiteBindBlobParams,
SQLiteBindPrimitiveParams,
SQLiteColumnNames,
SQLiteColumnValues,
SQLiteRunResult,
} from "./NativeStatement";
@jmatsushita
jmatsushita / live_as_source.css
Last active December 3, 2023 19:00 — forked from pmbauer/pseudo_focus.css
Obsidian CSS snippet to mimic source mode in live preview mode
/***
* Common tweaks
***/
/* Using the Github Theme with a few tweaks */
.theme-dark {
--background-primary: #1f1f1f;
}
/* display headings with normal font size */
@jmatsushita
jmatsushita / App.tsx
Last active September 12, 2023 14:53
Use.GPU 3d text
import React, { LC, hot, useFiber } from '@use-gpu/live';
import { HTML } from '@use-gpu/react';
import { AutoCanvas, WebGPU } from '@use-gpu/webgpu';
import { DebugProvider, FontLoader, PanControls, Flat, Pass, OrbitCamera, OrbitControls,
PointLight, AmbientLight,
} from '@use-gpu/workbench';
import { UI, Layout, Flex, Block, Inline, Text } from '@use-gpu/layout';
import {
@jmatsushita
jmatsushita / README
Last active December 26, 2024 00:34
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
###
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places.
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of
###. things to watch out for:
### - Check out the `nix-darwin` instructions, as they have changed.
### - There's a home manager gotcha https://github.com/nix-community/home-manager/issues/4026
###
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
module Main where
import Prelude
-- Trying to implement https://github.com/dorchard/effect-monad/blob/master/src/Control/Coeffect.hs
class CoEffect :: forall k. (k -> Type -> Type) -> ((k -> Type -> Type) -> k) -> ((k -> Type -> Type) -> k -> k -> k) -> Constraint
class CoEffect
-- class Coeffect (c :: k -> * -> *) where
c
@jmatsushita
jmatsushita / Main.purs
Created October 14, 2021 19:32
Set Monad (WIP)
module Main where
import Data.Foldable
import Prelude
import Data.Set as S
-- data Set a where
-- Prim :: (Ord a) => S.Set a -> Set a
-- Return :: a -> Set a
@jmatsushita
jmatsushita / Main.purs
Last active October 14, 2021 18:45
Existential types with constraints
module Main where
import Prelude
newtype AnyShow = AnyShow (forall r. (forall a. Show a => a -> r) -> r)
mkAnyShow :: forall a. Show a => a -> AnyShow
mkAnyShow a = AnyShow (_ $ a)
elimAnyShow :: forall r. (forall a. Show a => a -> r) -> AnyShow -> r
@jmatsushita
jmatsushita / Monad.purs
Created October 7, 2021 19:47
purescript-set-monad
module Data.Set.Monad where
import Prelude
import Data.Set as S
import Data.Foldable
import Data.Tuple.Nested
import Unsafe.Coerce
-- data Set a where
-- Prim :: (Ord a) => S.Set a -> Set a
Comonadic explorations
- Is day convolution as comonadic composition really free? What's the difference with Kenneth's Distribute based composition?
- How do specific comonads compose?
- cursors -> apart
- The cursor like intuition, extended to a range, starts feeing exactly like a lens !?
- If the data space has this comonadic structure, how does it compose with the ui components?
- If we can model time also as a comonadic cofree module/pattern, how do we sync with an event loop? Seems like the shape of the time dimension(s?) define a clock type!!! Actions are a time dimension :O ?!? I think that's also the coeffect/effect dimension (tricky with cursors on data, does it depends on whether a query is sent or should we abstract that out?).
- Chris's Zippers feel like Pairing
@jmatsushita
jmatsushita / Main.purs
Created July 2, 2020 12:03
Problem type checking with natural transformation in record type
module Main where
import Prelude
import Effect (Effect)
import Data.Foldable (fold)
import TryPureScript (h1, text, render)
data Nat m n = Nat (m ~> n)
data NatR m n = NatR { nat :: (m ~> n) }