Skip to content

Instantly share code, notes, and snippets.

View jer-k's full-sized avatar
🤖
Time to blog!

Jeremy Kreutzbender jer-k

🤖
Time to blog!
View GitHub Profile
@jer-k
jer-k / _1-README.md
Last active December 29, 2024 01:54
Setting up Zero with Ruby on Rails (session based auth) and Next.js

Reading through the Zero docs on authentication, I saw that JWT authentication was all that was supported (for now). I'm building a project using Ruby on Rails as an API and Next.js for the UI. While JWT auth is possible with Rails, most auth implementations are session based, included the built in auth solution to the latest Rails 8 release. Thus I wanted to figure out how to best set up Zero while still using the built in session based auth.

In this reply @aa, outlined how the Zero constructor can take a function for the auth param https://bsky.app/profile/aaronboodman.com/post/3ldyz5bet3s2s

This all sounds right. The auth param to Zero's constructor can be a function. When the token expires, Zero invokes the function to get a new token. It's async so you can call an endpoint or whatever.

and later

To clarify further:

  • keep the refresh token in an http-only cookie
@jer-k
jer-k / background-jobs.md
Last active October 16, 2024 19:06
Background job libraries, companies, etc

Background Job Libraries / Companies / Whatever

Collecting thoughts and information about background jobs across many different programming languages. What are commonalities, differences, etc. The list definitely won't be exhaustive, it just needs enough information to make some decisions.

Ruby

@jer-k
jer-k / apollo-client-next-rsc-cache.md
Created August 13, 2024 18:40
Apollo Client Next RSC Cache

An approach to building an Apollo Client cache for RSC

I wanted to figure out how I might be able to take advantage of Apollo Client caching while using RSC. I came up with this approach, which is rather rudimentary, but seems like a good starting point. It is taking advantage of the new localStorage API added in Node 22 https://nodejs.org/api/globals.html#localstorage

I built up a new query method which wraps the existing query and adds in ability to pass in an identifier (likely a user ID or something of that matter) to ensure that caches don't overlap.

@jer-k
jer-k / docker_cheatsheet.txt
Last active April 23, 2019 00:56
I need to remember all these things
You can exec into a container as root, rathern the defined USER
`docker exec -it --user root <> <cmd>
# Logging Related
`docker container logs —tail 5 <id>`
# Tagging and Pushing Images
The most generic way to define an image tag is <registry URL>/<User or Org>/<name>:<tag>.
When pushing, given no registry, Dockerhub is assumed.