TILs - Fueling Curiosity, One Insight at a Time

At Codemancers, we believe every day is an opportunity to grow. This section is where our team shares bite-sized discoveries, technical breakthroughs and fascinating nuggets of wisdom we've stumbled upon in our work.

Published
Author
user-image
Syed Sibtain
System Analyst
Dolt Workbench. Local UI for Beads Issues

Dolt Workbench is a SQL UI tool that connects to our local Dolt database. We can browse issues, run queries, and see commit history and more

How to connect:

1. Make sure your Dolt server is running:

Code

bd dolt start
  bd dolt status    # note the port number


2. Open Dolt Workbench and create a new connection:

Code

Connection Name: <name-here>
  Type: MySQL/Dolt
  URL: :<port>/beads


3. Leave password empty. Click "Launch Workbench".

What we can do:
• Browse tables: issues, dependencies, events, comments, config
• Run SQL queries: same as bd sql but with a visual editor
• View commit log: see every change made to the database
• Edit rows: update issue fields directly from the spreadsheet UI
• View diffs: compare changes between commits
#beads #dolt
Published
Author
user-image
Syed Sibtain
System Analyst
Beads (bd) uses Dolt as its database backend. A SQL database with Git-like version control. Issues are stored locally in .beads/dolt/ and synced to GitHub via invisible refs (refs/dolt/data).

Setup (fresh clone)

Code

brew install beads
sudo bash -c 'curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | bash'
mkdir -p .beads/dolt
dolt clone git+https://github.com/<org>/<repo>.git .beads/dolt/beads
bd dolt start
bd list


Daily commands

Code

bd ready                  # see available work
bd list                   # all issues
bd show <id>              # issue details
bd create --title="..." --type=task --priority=2  # create issue
bd update <id> --claim    # claim work
bd close <id>             # complete work


Sync with team

Code

bd dolt pull              # pull teammate's issues
bd dolt commit            # commit pending changes
bd dolt push              # push your issues


#dolt #beads
Published
Author
user-image
Syed Sibtain
System Analyst
NDJSON (Newline Delimited JSON): A file format where each line is a valid, independent JSON object, separated by a newline character (\n)

Regular JSON wraps everything in an array:

Code

[
    {"name": "Alice"},
    {"name": "Bob"}
  ]


NDJSON is one object per line, no wrapper:

Code

{"name": "Alice"}
  {"name": "Bob"}


Didn't know this existed. Turns out it's really useful for:
- Log files — each event is one line, easy to grep
- Streaming APIs — send objects as they're ready, don't wait for the full array
- Large datasets — process line by line without loading everything into memory

Also called JSONL (JSON Lines). Same thing. Claude Code uses this to send MCP messages over stdio
#json
Published
Author
user-image
Nitturu Baba
System Analyst
Ruby hashes treat strings and symbols as different keys.
But JSON data (JWT, APIs) always comes with string keys.

Code

decoded = { "user_id" => 1 }

decoded[:user_id]   # => nil ❌
decoded["user_id"]  # => 1


This silently breaks code when Rails-style symbol access is used.

We can use HashWithIndifferentAccess which removes this mismatch:

Code

payload = HashWithIndifferentAccess.new(decoded)

payload[:user_id]   # => 1
payload["user_id"]  # => 1


You no longer care whether keys are strings or symbols. Rails params works the same way internally.

HashWithIndifferentAccess is a class provided by ActiveSupport, so it exists only in Rails, not in core Ruby. It internally normalizes all keys (by storing them as strings) while allowing access using either symbols or strings. It’s designed specifically for boundary data—like JSON responses, JWT payloads, and request params—where key formats are inconsistent. By removing the need to care about key types, it prevents subtle nil bugs without forcing changes in how the rest of the code is written, which is why Rails uses it internally for params

#Rails
Published
Author
user-image
Satya
When two models are associated—for example, a Chat that has many Messages—you can create a message using @chat.messages.build instead of instantiating Message.new. This automatically sets the chat_id on the message, so it’s never niland the association is correctly maintained

#ActiveRecord #Rails
Published
Author
user-image
Syed Sibtain
System Analyst
What is Framing in WebSockets?
Framing is how WebSocket data is split, structured, and transmitted over the wire. Framing is protocol-level, not app-level

WebSockets do not send raw strings or JSON directly. Instead, every message is wrapped inside WebSocket frames.

Each WebSocket frame contains:
FIN bit – is this the final frame?
Opcode – what type of data?
Payload length
Masking key (client → server)
Payload data
Frame Types
Data frames
Text frame → UTF-8 text (JSON, strings)
Binary frame → raw bytes (files, protobuf)
Control frames
PING → check if connection is alive
PONG → response to ping
CLOSE → graceful shutdown
#websockets #client #server
Published
Author
user-image
Swasthik K
Cron in GitHub Actions
In GitHub Actions, you can schedule workflows using cron syntax inside the on.schedule field. It uses UTC time format.
Example:

Code

on:
  schedule:
    # Runs at 5:30 AM and 5:30 PM UTC every day
    - cron: '30 5,17 * * *'
    # Runs every 15 minutes
    - cron: '*/15 * * * *'
    # Runs every Monday at 9:00 AM UTC
    - cron: '0 9 * * 1'


Cron format:
┌───────── minute (0–59)
│ ┌─────── hour (0–23)
│ │ ┌───── day of month (1–31)
│ │ │ ┌─── month (1–12)
│ │ │ │ ┌─ day of week (0–6, Sun=0)
│ │ │ │ │
* * * * *

#GitHubActions #DevOps
Published
Author
user-image
Swasthik K
Syntax Highlighting & Language Detection with Highlight.js

It's a lightweight JS library that automatically highlights and detects code syntax on web pages — no need for manual markup.

Installing Highlight.js

Code

pnpm add highlight.js


Detect Language & Highlight

Code

import hljs from 'highlight.js';
import 'highlight.js/styles/atom-one-dark.css';

const code = `function sum(a, b) { return a + b; }`;
const { value, language } = hljs.highlightAuto(code);

console.log(language); // e.g. "javascript"
console.log(value); // highlighted HTML


• You can pass value to your React component and render it inside a code element with the hljs class for styling.
Highlight.js automatically detects the language and highlights it — perfect when your app handles multiple code types dynamically.

#JavaScript #Frontend #HighlightJS
Published
Author
user-image
Vaibhav Yadav
Senior System Analyst
Clean up merged Git branches easily

You can quickly delete all local branches that have already been merged into your current branch (like master or main) using a single command:


Code

git branch --merged | egrep -v "(^\*|master|main)" | xargs git branch -d


This command lists all merged branches, filters out the current and main branches, and deletes the rest safely. Perfect for keeping your local repo tidy after merging multiple feature branches.

#git #github #vcs
Published
Author
user-image
Puneeth kumar
System Analyst
Understanding the Difference Between Regular Imports and .forRoot() in NestJS

In NestJS, modules can be imported in two main ways — but they behave differently:

1 Regular Imports
• Example imports: [ProjectsModule, UserModule]
• These are simple — they bring in the module’s exports (like services or guards).
• They don’t need any setup or configuration.
2.1 forRoot() Imports
• Example imports: [SlackModule.forRoot(dbClient)
• These are special. They let a module set itself up with configuration or dependencies (like a DB client, API key, etc.).
• They create a global instance that’s initialized once across the app.
2.2 forRootAsync()
• Used when setup depends on async config — like environment variables.
• Example :

Code

PgBossModule.forRootAsync({
  useFactory: async (config) => ({
    connectionString: config.get('DATABASE_URL'),
  }),
  inject: [ConfigService],
});


Conclusion
Regular imports are sufficient when we just need access to a module’s services or exports.
forRoot() is useful when a module requires initial configuration or dependencies.
forRootAsync() is ideal when configuration depends on asynchronous operations, such as reading environment variables or fetching secrets.
#NestJS #import_module

Showing 1 to 5 of 83 results

Ready to Build Something Amazing?

Codemancers can bring your vision to life and help you achieve your goals