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
Codemancers
For models A and B, if A has_one B, then A.new.b.build wont work. You have to say A.new.build_b.
Published
Author
user-image
Codemancers
Sidekiq processes jobs in a multithreaded process. Which means there is no guarantee that the jobs that are enqueued will processed in the same order. So you'd need to consider the aspect of context switch that can happen and thus make sure that the worker code is thread safe.
Published
Author
user-image
Iffyuva
Today I came to know that the name of process which takes care of clipboard is called pboard on mac. If clipboard is acting funny, just kill this process!
Published
Author
user-image
Codemancers
while tesing with enzyme if you are unit testing your component method with component.instance().methodName() always double check if the method that you are testing have access to "this" variable manually. Currently even if it does not have "this" access the test will pass
Published
Author
user-image
Codemancers
You can create a quick screencast using hangouts and then share the video as a private youtube video
Published
Author
user-image
Codemancers
emacs has a "M-x base64-encode-region"
Published
Author
user-image
Codemancers
Rails 5 prevents accidental halting of the callbacks. In order to explicitly halt, we can make use of throw(:abort) in the callback chain.
Published
Author
user-image
Codemancers
Sidekiq by default does 25 retries (about 21 days) based on exponential back off formula ie. to retry multiple times with exponential delays. If need be, we can explicitly configure max_retries in sidekiq.yml.
Published
Author
user-image
Codemancers
while writing test for a parent component which renders child component based on some state/prop and if your child component is connected, always import unconnected child component and do assertion on that.
/code
import { ChildComponent } from 'path/to/component';

expect(component.find(ChildComponent).length).toBe(1);

//instead of
expect(component.find('ChildComponent').length).toBe(1);
Published
Author
user-image
Codemancers
In Rails we can do two modes of locking that is 'Optimistic Locking' and 'Pessimistic locking'. 'Optimistic Locking' assumes that a database transaction conflict is very rare to happen and such locked records can still be read (Shared lock). It uses a version number of the record to track the changes. This can be used by adding a lock_version column to the table and then is handled automatically by Rails.
Whereas 'Pessimistic locking' assumes that database transaction conflict is very likely to happen. It locks the record until the transaction is done (Exclusive lock). This can be done with ActiveRecord::Base#lock! or ActiveRecord::Locking::Pessimistic#with_lock.
Published
Author
user-image
Codemancers
a decent spreadsheet writer gem for ruby, https://github.com/felixbuenemann/xlsxtream, ran some rough benchmarks, and this one is the fastest and lowest memory consuming gem. although not feature complete.
Published
Author
user-image
Codemancers
there are command-line options which you can add to bash scripts, can be added in the header like #!/bin/bash -e

Showing page 35 of 42

Your competitors are already using AI.
The question is how fast you want to unlock the value.

Don't know where to start?

AI is everywhere but it's unclear which investments will actually move your metrics and which are expensive experiments.

Your data isn't ready

Most AI projects fail at the data layer. Pipelines, quality, access all need work before LLMs can deliver value.

Internal teams are stretched

Your engineers are shipping product. They don't have capacity to also become AI specialists with production-grade experience.

Legacy systems block everything

Aging, undocumented codebases make AI integration slow, risky, and expensive. They need to move first.

Don't worry. We've got you covered.

Start with the audit.