Skip to content

Instantly share code, notes, and snippets.

View seanstrom's full-sized avatar
:octocat:

Sean Hagstrom seanstrom

:octocat:
View GitHub Profile
@holyjak
holyjak / pathom3_lab_notes.adoc
Last active April 13, 2024 07:25
Pathom3 + Fulcro Lab Notes - experiences and tips from working with Pathom 3 with Fulcro

Various, unsorted notes from using and struggling with Pathom 3 with Fulcro.

Troubleshooting P3/F

Troubleshooting auto-generated Fulcro RAD id resolvers in Pathom 3

When something doesn’t work, I try to simplify it as much as possible. Often it starts working at some point. Then I try to find the exact point where it starts/stop working by bringing the broken and working alternatives closer together. And this is exactly what I did when my auto-generated RAD id-resolver did not return the expected data. It might be useful to know the steps along this path for any future troubleshooting.

This problem has two dimensions - the parser and the resolver. Here I move mostly along the parser dimension, while in the end I discovered the problem was with the resolver. Still, it is a valuable knowledge.

(ns app.application
(:require
[com.fulcrologic.fulcro.application :as app]
[edn-query-language.core :as eql]
[com.fulcrologic.fulcro.algorithms.tx-processing :as txn]
[promesa.core :as p]
[com.wsscode.pathom3.interface.eql :as p.eql]
[com.wsscode.pathom3.connect.operation :as pco]
[com.wsscode.pathom3.connect.indexes :as pci]))
@jerblack
jerblack / 1. Dark Mode in OSX with Go.md
Last active April 29, 2024 17:22
Golang: Detect dark mode change in OSX

I wanted to be able to detect when Dark mode was turned on or off in my Go program so I can swap icons in my tray app, but the Apple-blessed methods all use Swift and ObjectiveC. To work around this I figured out the following:

  • When dark mode is set, a property called "AppleInterfaceStyle" is set to "Dark" for the user.
  • When dark mode is disabled, that property is removed.
  • You can see this by running "defaults read -g AppleInterfaceStyle"
// Dark Mode On  
defaults read -g AppleInterfaceStyle  
 Dark 

React Native + macOS + Clojurescript

image

Project Catalyst

Since the recent release of Catalina, macOS has shipped with the ability to allow iOS/iPAD apps to run on macOS without any modification via a featureset known as Project Catalyst.

This is exciting, as writing React Native + Clojurescript apps as a target for the desktop is much more compelling than a pure Electron app (imo).

@acutmore
acutmore / README.md
Last active January 21, 2024 20:30
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)

A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
  [
    ["push", N_1],         // 1
    ["push", False],       // 2
 ["peek", _], // 3
@mathiasbynens
mathiasbynens / escape.js
Created June 26, 2019 07:29
Escaping JSON-stringified data for use as a JavaScript string literal
// This object contains a string value that in contains a single quote,
// a double quote, a backtick, and a backslash.
const data = { foo: `a'b"c\`d\\e` };
// Turn the data into its JSON-stringified form.
const json = JSON.stringify(data);
// Now, we want to insert the data into a script body as a JavaScript
// string literal per https://v8.dev/blog/cost-of-javascript-2019#json,
// escaping special characters like `"` in the data.
@yelouafi
yelouafi / algebraic-effects-series-1.md
Last active February 24, 2024 16:03
Operational Introduction to Algebraic Effects and Continuations

Algebraic Effects in JavaScript part 1 - continuations and control transfer

This is the first post of a series about Algebraic Effects and Handlers.

There are 2 ways to approach this topic:

  • Denotational: explain Algebraic Effects in terms of their meaning in mathematics/Category theory
  • Operational: explain the mechanic of Algebraic Effects by showing how they operate under a chosen runtime environment

Both approaches are valuables and give different insights on the topic. However, not everyone (including me), has the prerequisites to grasp the concepts of Category theory and Abstract Algebra. On the other hand, the operational approach is accessible to a much wider audience of programmers even if it doesn't provide the full picture.

@zaceno
zaceno / squirrel.js
Created August 29, 2018 11:17
Squirrel -- utility for defining transformations of deeply nested objects
/*
Squirrel helps you work with data held in deeply nested objects
It creates a mapping based on a given `path`. The mapping transforms a unary function `f`
into a function that applies f to the given path of a given object.
The path is given as a string, with each nesting level separated by a '.'
Some examples:
@jmlsf
jmlsf / js-in-cljs.md
Last active January 25, 2024 23:15
Using JavaScript modules in ClojureScript

Using JavaScript Libraries from ClojureScript

Using JavaScript libraries from ClojureScript involves two distinct concerns:

  1. Packaging the code and delivering it to the browser
  2. Making ClojureScript code that accesses JavaScript libraries safe for advanced optimization

Right now, the only single tool that solves these probems reliably, optimally, and with minimal configuration is shadow-cljs, and so that is what I favor. In paricular, shadow-cljs lets you install npm modules using npm or yarn and uses the resulting package.json to bundle external dependencies. Below I describe why, what alternatives there are, and what solutions I disfavor at this time.

Packaging and Delivering Code

@OleksiyRudenko
OleksiyRudenko / Build-and-Publish.md
Last active March 28, 2024 02:04
Building and publishing a web app @ github pages using ParcelJS