RSSAmplifier

Blog

jackieli.dev

Recent content on jackieli.dev

jackieli.devRSS feed ↗15 posts

Latest posts

Why I built gsx

I have been building gsx , a Go template compiler with JSX-style markup, component declarations, and plain Go output. The obvious question is: why? More specifically: why not just use templ ? Firstly, I like templ. gsx is not built because I think templ is bad. In fact, gsx is intentionally compatible with the templ ecosystem. A gsx.Node has the same render shape as templ.Component : Render ( ctx…

What's next for Coc.nvim

As a huge fan of Coc.nvim, I’m eager to see it being enjoyed by more people and continuously improved, despite facing competition from built-in LSP clients inside Neovim. People may want “small” components to have composability and control over things, which is what the built-in LSP client is about. For some users out there, it will work, but for the vast majority of us, being…

Temporal is a Control Plane

Use Temporal as a control plane, not as a data plane - @maxim Problem Link to heading In a typical ETL-like scenario, the data come as streams of rows. The workflow need to wait for a row to arrive and then kick off a series of processing steps synchronously or asynchronously. Example like: From intuition, we might implement the workflow like this:

Temporal.io errGroup

Recently during develop a temporal workflow, I found I need an errGroup implementation - an easy way to synchronise the cancellation of all Temporal coroutines when one of them returned error. I adapted the x/sync/errgroup . Here is the code: package main import ( 'errors' 'log' 'sync' 'time' 'go.temporal.io/sdk/testsuite' 'go.temporal.io/sdk/workflow' ) func Workflow ( ctx workflow . Context ) (…

Vim jump to caps word on the same line

I often find myself wanting to jump to the word starting with capital letter on the same line. Especially in Go where the methods you import package always starts with capital letters. E.g. <> fmt.Println('Hello World') When you cursor is at <> there are a few ways to quickly jump to Println : press w three times (because there is a dot) press fP press l many times until you&rsquo;re at P But it…

GRPC & GRPC-Web multiplexed in Istio

Envoy had grpc-web support ealy on. It&rsquo;s used in the official grpc-web tutorial docs . In the envoy config of this tutorial, both grpc & grpcWeb are exposed via a single listener port. This is nice model when you have a production deployment in which some clients (mobile apps) want to speak to the GRPC protocol directly, but web apps want to go down to http/1.1 to work with browsers&rsquo;…

Use dynamic proto in cel-go

Cel-go is an amazing library for evaluating expressions. The extensive proto support just makes it better. Let&rsquo;s explore an interesting problem: if we were to build a evaluation service without embedding the actual proto, i.e. without bundling the generated code that defines the struct, fields etc, how can we still evaluate the expressions that requests the contents of the proto messages?…

Pointers in Go - used in sql.Scanner

Firstly a fun fact a lot people don&rsquo;t know: when passing values between functions, it&rsquo;s cheaper to pass values instead of pointers in Go. Reason is pointers to objects could be allocated on heap and it takes the computer more efforts to managed heap memory. While values are save on the stack, and stack is cheaper. For example, it&rsquo;s preferable to: type Foo struct { Bar string }…

gRPC-Web interceptor

This was supposed to be 5 minute job, or at least it looked like it after I skimmed through the documentation This was my first attempt: class AuthInterceptor < REQ extends Request , RESP = any > { Intercept = class { private stream : grpcWeb.ClientReadableStream < RESP >; constructor ( stream : grpcWeb.ClientReadableStream < RESP >) { this . stream = stream ; } on < F extends Function >(…

Javascript Date

So I need a way to represent LocalDate that can be found in java.time package. Turns out it&rsquo;s harder than it looks. Take LocalDateTime for example: LocalDateTime is a relative date that&rsquo;s the same no matter which time zone you&rsquo;re in. The easiest thing is to just use string: 2020-07-25T01:02:03 . Note that there is no zone/offset information in the string But if you want to use a…

BigInt toBytes in different languages

Go & Javascript seems to be doing the same thing on BigInt: toBytes returns the absolute value with the sign seperately. While Java returns the Two&rsquo;s complement representation. It makes it just a bit trickier to get the right binary representation. This post explores ways to implement the Two&rsquo;s complement representation in javascript & Go javascript Link to heading $ node > BigInt (…

BigInt to Uint8Array

The problem came when I wanted to pass down BigDecimal&rsquo;s unscaledBytes from kotlin/java to javascript through gRPC-Web. Java&rsquo;s implementation of the unscaledBytes returns signed big-endian bytes Javascript has BigInt support, but lacks of toBytes() , stuff around the internet all seems to handle positive numbers just fine, but fails in negative number implementation I borrowed from a…

About me

I&rsquo;m a developer. I write Go, Kotlin and some javascrpt, typescript etc

Contact

Hello to you too

Projects

Nothing to see here&hellip; Move along!