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
Soniya Rayabagi
rm -rf .git by running this command you are essentially deleting the entire Git repository, including all the commit history, configuration files, and any other Git-related data, from the current directory as it permanently removes the Git version control .
Published
Author
user-image
Satya
In fly if your machine has stopped , we can restart the machine by redeploying the app.
Published
Author
user-image
Syed Sibtain
System Analyst
Dart has three types of variables, var, final and const
1. var is used for dynamic typing, allowing the type of the variable to be inferred at runtime.
2. final is used to declare a variable that can only be assigned once. It must be initialised when declared, and its value cannot change.
3. const is used to declare a compile-time constant. It must be initialised with a constant value, and its value cannot change.
Published
Author
user-image
Ashwani Kumar Jha
Senior System Analyst
In TypeScript, type annotations are removed when transpiling to JavaScript. This make us believe that type information is lost in JavaScript runtime. However, TypeScript offers a compiler option called emitDecoratorMetadata that, when enabled, emits metadata about the types used in our code. This metadata is accessible at runtime using reflect-metadata library.
Libraries like class-transformer and class-validator leverage this metadata to transform plain JavaScript objects into instances of specific classes and validate them against certain rules. Even though TypeScript types don't exist at runtime, the information about those types does, this provide us a more structured and safe way of working with data in JavaScript.
Published
Author
user-image
Iffyuva
One liner for adding a delay in Typescript: await new Promise((r) => setTimeout(r, 2000));
Published
Author
user-image
Sujay
Difference between const and final in Dart
• Even though both const and final cannot be reassigned, there is a subtle difference between them.
const variables are used for compile-time constants whereas final variables are used for run-time constants.

dart

const current_time = new DateTime.now() // DON'T do it as the value is computed at run time
const name = 'Rahul' // DO it as the value is known at compile time


• When reading from database or reading from a file, the values won't be known at compile time. Use final in such cases
Published
Author
user-image
Soniya Rayabagi
figured out how we can use gitignore to add the .DS_STORE files into it by deleting the ds.store file first , and then using echo ".DS_Store" >> .gitignore to add the .ds_store file.
Published
Author
user-image
Soniya Rayabagi
Using git url to clone repo instead of https will not ask password on every git push/pull
Published
Author
user-image
Soniya Rayabagi
figured out how we can use gitignore to add the DS.STORE files into it by deleting the ds.store file first and using echo ".DS_Store" >> .gitignore to add the file.
Published
Author
user-image
Soniya Rayabagi
Using git url to clone repo instead of https will not ask password on every git push/pull

Showing page 41 of 83

Ready to Build Something Amazing?

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