Blog Page 2
Forbidden Typescript: Enumerating Properties
In āJavaScript: The Definitive Guideā, there are functions described in 6.5 Enumerating Properties that probably shouldnāt be used in production code because they modify their input parameters: extend
, merge
, restrict
, and subtract
.
Forbidden Typescript: Using Object.create to clone
In āJavascript: The Definitive Guideā there is an example that uses Object.inherit
to inherit the prototype change. JavaScript defines a method Object.create
that creates a new object using the given argument as the prototype of that object. Translating the examples from The Definitive Guide to Typescript, it looks like:
Data on the Wire
Back when Meteor was in vogue, they popularized the concept of āData on the wireā. This was the idea that the UI would be updated with changes from the dataset it is subscribed to.
Component Library Checklist
The following is a checklist I like to use to ensure I'm covering all the bases when building a component library. It's a work in progress, but I hope it can be useful to others.
Debugging slow tsc
I was working on a project and I noticed the tsc
check that we ran on pre-commit hooks had become dramatically slower. I was seeing near instant times to type check the entire project go to agonizingly slow minutes to check the project. I was able to narrow the range of commits to some change we made within a month window. Iām sure I could have narrowed it down by continuing to git bisect and re-running time npx tsc
, but it was much easier to just check out main and try out the following:
ChatGPT, Coding, and Language
Iāve been experimenting with ChatGPT, just like everyone else. But why has it become so popular? It truly is a revolutionary piece of technology. Is it The Next Big Thing? Will it really replace all of us?
Backend for Frontend
The Backend for the Frontend (BEFFE) is typically stateless and acts as a proxy for other services, including authentication, authorization, and core services. The recent divorce of browser code being rendered by backend services was created by SPAs - Single Page Applications. In simpler architectures, a SPA and service could be as simple as:
AI Feedback Systems
We are starting to see a rise of novel use-cases for AI in products and games using LLMs. Rather than the simple chatbot like experiences we have seen in the past using AI, we are starting to see feedback systems being added to these experiences, providing additional context to the LLM than just the past conversation.
Fast Similar Embedding Lookup
While working on the Clarity Hub NLP API, we had a common use-case where we would create embeddings from text, and use those embedding to determine cosine similarity with other embeddings. Doing this required loading all of the embeddings in-memory and then computing cosine similarity with the entire dataset. As the dataset grew, this operation would get incredibly slow.
Sora - OpenAI Visual Studio Code Extension
Github Copilot and other AI tools are hitting the scene. I decided to create my own Visual Studio Code extension, which is designed to use OpenAIās APIs to bring some additional ChatGPT functionality into the code editor. The goal with Sora was to enable a developer to thoughtfully write a comment about the code they would like the AI to write, and then commit to it ā rather than the real-time typeahead that Github Copilot provides.