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.
Apr 27, 2018
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);
/code
import { ChildComponent } from 'path/to/component';
expect(component.find(ChildComponent).length).toBe(1);
//instead of
expect(component.find('ChildComponent').length).toBe(1);
harshwardhan
Apr 23, 2018
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.
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.
akshay
Apr 20, 2018
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.
mrinmoy
Apr 20, 2018
This is a good read about common Rails errors which rollbar has captured https://rollbar.com/blog/top-10-ruby-on-rails-errors/
Yuva
Co-founder
Apr 16, 2018
http://api.rubyonrails.org/v5.0/classes/ActiveRecord/QueryMethods.html#method-i-left_joins since rails 5
mrinmoy
Apr 12, 2018
row caching and stream: true option for mysql2 https://github.com/brianmario/mysql2#row-caching
mrinmoy
Apr 10, 2018
there are command-line options which you can add to bash scripts, can be added in the header like
#!/bin/bash -e
manu
Apr 10, 2018
set -x
is very useful while writing shell scripts. It echos commands being run (even in for loops) which helps in debugging. Put this at the top of script file, and see the magic!Yuva
Co-founder
Showing 63 to 65 of 76 results
Ready to Build Something Amazing?
Codemancers can bring your vision to life and help you achieve your goals
- Address
2nd Floor, Zee Plaza,
No. 1678, 27th Main Rd,
Sector 2, HSR Layout,
Bengaluru, Karnataka 560102 - Contact
hello@codemancers.com
+91-9731601276