All Blogs
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Kiprosh
is now part of
LawLytics
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
While evaluating [BatmanJS(BatmanJS)][1] for one of the biggest application here @Kiprosh, I found it very much Rails like and started drawing parallels when I was doing MVP with Rails and BatmanJS. Note: This is not a tutorial for [getting started(Getting Started)][2] or [building rails app with BatmanJS(Another getting started)][3] . I personally like [Zack hubert's blog(Zack hubert's blog)][4] and [Batman for SuperHeroes(Batman for super heroes)][5] If you are book lover, you will certainly like [cookbook(Cookbook for BatmanJS)][6] I am sharing my experience on possible approaches/concepts to move view-layer
Hello Team, Last week I got an opportunity to refactor code for one of our projects. Along with that I got an opportunity to share some code modules that can be used in other projects. It was a good experience. I also found some places in the code where performance of the app could be improved by refactoring the code. Please feel free to correct me if I am wrong at any place. Please do let me know your suggestions. Refactored code snippets: 1)Eg: FactoryGirl.define do factory :attachinary_file do attachinariable_type { 'Bottle' } scope { 'images' } public_id { ('a'.
Hello Everyone, I have reviewed my application and extracted out few methods, which we can reuse in other applications if required. To normalize url def normalize\_url(url) url = url.strip /^http/.match(url) ? url : "http://#{url}" end Display image and default image if image is breaking def display\_image(object) default\_image = "/assets/default_image.jpg" on\_error\_pic = "this.onerror=null;this.src='"+ default\_image +"';" image\_tag object.pic.url(:style), alt: "", onerror: on\_error\_pic end Time in HH:MM:SS format def time\_in\
In our recent project , we came across one scenario, where we had to pass an unsaved record as argument in background job. As delayed_job doesn't allow unsaved AR objects as arguments ref: delayed_job issue when deserialising arguments we used serializing/deserialising approach for passing params. class PassingData def serialize(data) Base64.encode64(Marshal.dump(data)) end def deserialize(serialized_data) serialized_data = Base64.decode64(serialized_data) Marshal.load serialized_data end end user_details = PassingData.serialize @user where @user = user_data Mailer.delay.order_process("order confirm", user_details) #send mail in background #mailer method def order_process(
Code Review Hello Everyone, I have reviewed a codebase of one of our projects. It was a good experience. Few good things. Really clean code. Small methods. I had to travel 5 months back commits to find some bad code. :) Things to improve on: Found less specs, But it is possible that specs have been covered already. Overall Thoughts: The code is super clean, liked it!. fantabulous work folks! Snippets: Code: Menu.pluck(:hyphenated_name) Suggestion: This can be moved to class method which can be cached instead of firing the queries in the app again and again, one problem
Hello Team, Last week, I got the chance to review the latest code commits from one of our projects. This was a helpful step for me to learn good things from it. Please suggest me, if there are any improvements needed. Replace instance variable with local variable in partial. or so that use local variable in partial instead of instance variable. Best practice to add semicolon ( ; ) at the end of every statement in js file. Best practice to write css (styles) only in css folder rather than inline css in view file. Best practice to Use spaces around operators, and
Hello Team, In last week, I got the opportunity to review the latest code commits from one of our application. It was a very good experience for me to learn many new things from it. For the following code snippets, I have also added few suggestion from my part, they may be relevant or not, as am not aware of what exact functionality is performed by those snippets. As per my thinking, the developer who add the lines of code knows more about it and also knows how he can improve it more better than any other code-reviewer. So please
Using as Gem: gem 'gettext_i18n_rails' Using as plugin: gem 'fast_gettext', '>=0.4.8' Add "gettext" if you want to find translations or build .mo files Add "ruby_parser" if you want to find translations inside haml/slim files gem 'gettext', '>=3.0.2', :require => false, :group => :development gem 'ruby_parser', :require => false, :group => :development Rakes: rake gettext:add_language[XX] This will also create the locale directory (where the translations are being stored) where XX is the ISO 639-1 2-letter code for the language you
What does Integration testing mean ? Wiki says: Integration testing is the phase in software testing in which individual software modules are combined and tested as a group [Read More][1] When a software grows(may it be written in Ruby or Java or any other language for that matter), stability can become an issue as the application evolve and grow. Integration tests provide a great way to perform end-to-end tests that validate the application is performing as expected. The BDD-TDD life cycle goes as follows: Integration relates more towards BDD, so let's briefly get to know how BDD works. When
What is mock ? A mock is an object which we can use on behalf of another object. In short, mocking is creating (fake) objects that simulate the behavior of Real Objects. An object under test may have dependencies on other (complex) objects. To isolate the behavior of the object you want to test you replace the other objects by mocks that simulate the behavior of the real objects. When to mock ? Mocking is required when real objects are impractical to incorporate into the unit test. Most of the time external services or methods we have to mock. Once mocked, the