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
Syed Sibtain
System Analyst
The rails routes command generates a comprehensive list of all routes defined in our Rails application, displaying the HTTP method, URL pattern, controller, and action associated with each route.
#rails
Published
Author
Satya
find your rails code smells by using a gem called flog . Flog finds the most tortured code in your codebase.
Code
gem install flog
then run
Code
flog app lib
it will print the flog score for the all files that has score more than or equal to 10. Generally we should make sure flog score should be less than 10. Note: The more the flog score , the more pain the code is in. #rails #code-smells #flog
Published
Author
Syed Sibtain
System Analyst
In Ruby, instance variables are variables that belong to a specific instance of a class. They are prefixed with the @ symbol and are accessible within the instance methods of that class. Instance variables allow objects to maintain state and store information unique to each instance. Example:
Code
classPersondefinitialize(name, age) @name = name @age = ageenddefsay_introputs "Hello, mynameis #{@name} and I am #{@age} years old" endend# Create a new instance of Personperson1 =Person.new("John",18)# Call the say_intro methodperson1.say_intro
In this example, @name is an instance variable of the Person class, representing the name of each Person object created. The initialize method is a constructor that sets the value of @name when a new Person object is created. The say_intro method uses the instance variable @name to give the intro of the person with their name and age when called.
#ruby
Published
Author
Nisanth
The docker stats command is a powerful tool provided by Docker to monitor the resource usage of running containers. It provides a real-time stream of various metrics such as CPU usage, memory usage, network I/O, block I/O, and the number of processes (PIDs) running inside each container. This command is particularly useful for performance analysis and ensuring that containers are running within their resource limits. Example Explanation
active_record_doctor performs variety of health checks to identify and rectify common database issues like missing foreign key constraints, missing NON NULL constraints, missing presence validations, incorrect presence validations on boolean columns and many more. Ref: https://github.com/gregnavis/active_record_doctor #rails #database
Published
Author
Sagar Ghorse
while integrating sentry with gitlab ip whitelisting needs to be done on gitlab server (self-hosted) #devops #sentry#gitlab
Published
Author
Soniya Rayabagi
The kubectl cordon NODE_NAME command is used in Kubernetes to mark a node as unschedulable, meaning no new pods will be scheduled onto that node. Existing pods on the node will continue to run unless explicitly terminated or moved. #devops #kubernetes
Published
Author
Nisanth
Debugging Kubernetes pod on helm helm upgrade unleash-app-toggle . --debug Adding --debug can provide more insight if the error persists, showing exactly what values are being passed to each template. #devops #kubernetes #helm
Published
Author
Nisanth
Avoid Using Double Quotes for Environment Variables When configuring the PostgreSQL user and database names in a Helm values.yaml file, I initially wrapped the values in double quotes. This led to a frustrating issue where I couldn’t connect to the database, receiving errors that the role did not exist. The double quotes were being interpreted literally, causing mismatches in authentication. Solution: I removed the double quotes around the environment variables in my Helm chart and reapplied the configuration. This corrected the problem, and I was then able to connect successfully to the database. #devops #postgres #env
Showing 25 to 27 of 83 results
Ready to Build Something Amazing?
Codemancers can bring your vision to life and help you achieve your goals