Skip to content

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.

  1. Mahrukh Mir
    Components:
    Components are user interface elements that can be reused throughout the design file. They make design more consistent and allow for more rapid modifications.
    Components can be made from a layer , groups or frames.

    • Generally, there are two sorts of components:
    1. Main Component: It is normally built first and is responsible for specifying several UI styles in the UI element.
    2. Instance Component: This is the single occurrence main component.
    When the main component is modified. It is automatically applied to the instance component. However, modifications to Instance components must be made manually.

    The changes we make to the instance component are referred to as override. When we override an instance component and afterwards make modifications to the main component, the override does not change.
  2. Lambda
    A lambda is a way to define a block & its parameters with some special syntax.
    You can save this lambda into a variable for later use.
    The syntax for defining a Ruby lambda looks like this:

    Ruby

    say_something = -> { puts "This is a lambda" }

  3. Scopes
    Scopes are custom queries that you define inside your Rails models with the scope method.
    Every scope takes two arguments:
    1. A name, which you use to call this scope in your code.
    2. A lambda, which implements the query.
    It looks like this:


    Ruby

    class Fruit < ApplicationRecord  
       scope :with_juice, -> { where("juice > 0") }
    end


  4. RSpec double is a method provided by the RSpec library for creating test doubles, also known as mocks. Test doubles are objects that stand in for real objects in your system during tests.
  5. if we are using tailwindcss-rails gem we don't need cssbundling-rails gem because tailwindcss-rails gem is a standalone version of Tailwind CSS that integrates with rails asset pipeline. It's a simpler and more direct alternative for rails applications because it doesn't require Node.js at all.
  6. .abs method in Ruby is used to return the absolute value of a number. The absolute value of a number is its distance from zero, regardless of direction. In other words, it's the number without its sign.
    Here's an example:

    Ruby

    num = -10
    puts num.abs # Outputs: 10


    In this example, num.abs returns 10 because the absolute value of -10 is 10.
    Similarly, for a positive number:

    Ruby

    num = 10
    puts num.abs # Outputs: 10


  7. How to drop DB and add new database dump in Mongo db.
    1. Open terminal and enter mongo
    2. Enter show dbs to list all the databases
    3. Enter use <dbname> and select the database.
    4. Enter db and this will show the selected database (optional)
    5. Enter db.dropDatabase() and it will drop the database and show the following response { "dropped" : "<dbname>", "ok" : 1 }

    To add a new data dump, use the below command.
    1. mongorestore --db <dbname> <path>
  8. Mahrukh Mir
    Gestalt Principles:
    It explains how humans perceive visual aspects and how the human brain creates order from chaos. The human brain organizes and simplifies complicated visuals composed of numerous components into a single entire system. Humans will look for patterns and structure to create an image rather than seeing distinct, separate components.

    Some Gestalt Principles are as follows:

    1. Similarity:
    when two elements appear to be similar, we group them together. We also prefer to believe they serve the same purpose.
    Elements with similar shapes, sizes, color's, or orientations are believed to be related.

    2. Proximity:
    The elements that are close together appear to be more linked than things that are farther apart.

    3. Closure:
    When there are gaps or missing portions, our brain fills in the gaps to perceive a full shape or entity.

    4. Focal point:
    Visual elements that stand out will catch and hold the viewer's attention right away.

    5. Invariance:
    People can distinguish objects regardless of their shape, rotation, or scale.

    6. Continuity:
    Elements placed on a line or curve appear to be more connected than elements not arranged on a line or curve.
  9. Soniya Rayabagi
    We can rename the current local Git branch name by,\r
    • Switch to the main via the command git checkout master.\r
    • Enter the following command to rename a Git branch git branch -m old-name new-name .\r
    • To ensure that the rename was successful, retrieve the current status of the branch using the git branch -a.
  10. Soniya Rayabagi
    We can Rename the current local Git branch name by,
    • Switch to the main via the command git checkout master.
    • Enter the following command to rename a Git branch git branch -m old-name new-name .
    • To ensure that the rename was successful, retrieve the current status of the branch using the git branch -a.
  11. If we import a server component inside a client component, it will be treated as a client component but if we pass a server component to a client component as a child prop, it will not be converted to the client component and will be treated as a server component. This gives more granular control on what to show at what component. Composable child components will still be treated as client components as it is not passed as a child to the client component.
  12. while upgrading your rails api only app to support html views , make sure to run rails assets:precompile in your local so that your assets are served properly and also make sure your assets are properly linked in assets/configs/manifest.js , or the process will be aborted.
    If we skip this step, and it has some errors, it will cause build failures.
  13. while updating ruby version in an existing app, make sure to also update the ruby version in your Dockerfile, or else it will cause build failure.
  14. while creating rubocop github action , we need to add two flags:
    • fail_on_error: true -> which will exit the process when error occurs
    • filter_mode: noFilter -> this will run the rubocop for the entire project directory
  15. Codemancers
    Removing swap files form the merge -: we can can use our terminal for that we have to just ad the changes to the git then commit them with a message and then push the changes to repo and it will automatically reflect on the merge request.
  16. Mahrukh Mir
    The basic principles for User Interface design
    1. Hierarchy: User should be able to distinguish between important and less important information at a glance. The UI hierarchy should highlight what the user cares about the most.
    2. Contrast: To draw attention to important content or features.
    3. Alignment: Proper alignment helps with readability.
    4. Clarity: There should not be anything that will confuse the user. We should try to provide a design that user can understand easily by taking a glance at it.
    5. White space: For a design to work better. It needs to have a adequate amount of space between it's content.

  17. Ruby

    Add the `:environment` task as dependency for Rake task to access models.
    
    desc "count number of users"
    task :count_users do
      puts User. count # NameError: uninitialized constant User (NameError)
    end
    
    To make the models available, tell Rails to load the environment before running the task.
    desc "count number of users"
    task count_users: [:environment] do
      puts User. count
    end

  18. How to enable web view to inspect website which is open on iphone

    1. you have to first go to your iphone setting and search for the safari then then you got the advance option click on that then you got the web inspector enable that option.
    2. now connect your iphone with your mac and now open the safari browser in the mac
    3. Now click on safari option in the mac then click on preferences and go to Advance option and enable the show develop menu on menu bar now you have the develop option on you mac safari menu bar.
    4. Now click on the develop option and you get your iphone option and now you will able to inspect your website which is open in your iphone
    This is helpful to resolved bug which is only happen on iphones
  19. HIGH LEVEL DESIGN
    It is simply a blueprint for the system. In other words, a generic system design that describes the overall architecture and design of a system.
    1. System - is a set of components put together to build a product/feature.
    2. Feature - is a set of requirement to be satisfied.
    System Design is necessary to ensure that a system meets specific requirements, such as performance, reliability, scalability, and maintainability.
    Without a clear blueprint, a system may not work as intended, leading to performance issues in the future, downtime, etc.

    High-level design also includes:
    1. Overall Architecture.
    2. Database design
    3. Main Components
    4. Services and platforms

Showing page 20 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.

Book a free discovery call