2. i learned how to write test cases for the components like filtering and sorting.
3. i learned how to mock api using the jest.
TILs
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.
cloudflared tunnel --url http://localhost:<PORT>Pick utility allows us to create a new type by picking a subset of properties from an existing type. Instead of duplicating field declarations we can use Pick utility to extract new types.TypeScript
type AdminUser = {
id: number;
name: string;
email: string;
phone: string;
password: string;
age: number;
isAdmin: boolean;
...
}TypeScript
type BasicUser = Pick<AdminUser, 'id' | 'name' | 'email'>;JavaScript
<dialog>
<!-- Dialog Content -->
</dialog>open attribute to your dialogJavaScript
<dialog open>
<span>You can see me</span>
</dialog>open attribute directly, though, as that only allows you to open a non-modal dialog. Instead, you should use the show() and showModal() JavaScript methods.JavaScript
const dialog = document.querySelector("dialog")
dialog.show() // Opens a non-modal dialog
dialog.showModal() // Opens a modaldialog element you just need to use the close() method.dialog element is a modal you can use the Esc key to close it.JavaScript
const dialog = document.querySelector("dialog")
dialog.close() // Closes the dialogmain and production, we cannot open PR directly. We do the following:git fetch and then go to production -> git checkout productionproduction -> git checkout -b <branchname>main -> git pull origin main or git merge mainproductionCode
git reset --hard origin/master
says: throw away all my staged and unstaged changes, forget everything on my current local branch and make it exactly the same as origin/master.
You probably wanted to ask this before you ran the command. The destructive nature is hinted at by using the same words as in "hard reset".vi for it.Code
vi.mock("next/router", () => ({
useRouter: () => ({
replace: vi.fn(),
}),
}));replace: a mock function that simulates the behavior of the replace method of the Router object.Error: NextRouter was not mounted.|| as string concatenation instead of +allow xx.xx.xx.xx/range(32); and deny all;. Further we can make sure nginx passes some headers to the app using the rules proxy_set_header Host $http_host;.(CURRENT_DATE - INTERVAL '18 years')::date < TO_DATE(T3.DATE_OF_BIRTH, 'YYYY-MM-DD')Code
if(typeoflocalStorage!== 'undefined') {
// Use localStorage here
}fg command. Say the server is running and we want to install a packageCode
1. Ctrl+Z
2. yarn add jsonwebtoken
3. fgShowing page 24 of 42
AI is everywhere but it's unclear which investments will actually move your metrics and which are expensive experiments.
Most AI projects fail at the data layer. Pipelines, quality, access all need work before LLMs can deliver value.
Your engineers are shipping product. They don't have capacity to also become AI specialists with production-grade experience.
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.