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.
It was normal Monday like every week. I got my laptop and pressed the Power button then I remembered that I had not Suspended(Hibernated) my machine but instead had shut it down last Friday to make sure the memory is not occupied and system runs faster . Now the problem with shutting down is, I have to start eight different servers to get my Crossroad's apps up and running. Just for this reason ,I refrained from Shutting Down my machine every day and instead chose to Suspend which would save me from hitting numerous keyboard keys and do the same
Many times App's rate and reviews decides app's success. Reviews by user's are important part of app and decides what are good things about our app and what improvements are needed. Now a days its common to provide Rate & Review button or link that will redirect to app store or play store. If we have cordova app then we can simply do it in following way using js. We can identify whether device is android or ios and accordingly open it in window. $('#rate-app').on('click', function(e) { if (iosDevice) { window.open('https://itunes.apple.com/us/app/
There may be times when you want to decouple your form objects from the model, in simple words, insert another layer between your View and the Model, Reform is all about that. Reform gives you a form object with validations and nested setup of models. It is completely framework-agnostic and doesn't care about your database. Installing Reform Add this line to your gemfile ; gem 'reform' Since Reform 2.2, you've to add reform-rails gem to your gemfile to automatically load ActiveModel/Rails files. gem 'reform-rails' Defining Forms Let's say we want to decouple our Model Album, which has title attribute.
ActiveRecord Attributes And Defaults - The Old Way Imagine that you are in a vacation rental industry and you are adding a new model for handling reservations for rentals, let’s call it Reservation. To keep it simple for the purpose of this example, let’s assume that we need start_date and end_date date fields for handling the duration of the reservations and price field, which is pretty useful unless you are developing an app for a charity organization ;). Let’s say we want to provide some defaults for the start_date and end_date attributes to be
It is said that ''It is not happy people who are thankful; It is thankful people who are happy''. An attitude of gratitude means making it a habit to express thankfulness and appreciation in all parts of your life, on a regular basis, for both the big and small things alike. "If you concentrate on what you have, you'll always have more. If you concentrate on what you don't have, you'll never have enough." We should wake up every day and express to ourself what we are grateful for. We should acknowledge ourselves for what we have done
Side Loading Ember Data supports “sideloading” of data; i.e., indicating that data should be retrieved (along with the primary data requested) so as to help multiple related HTTP requests. A common use case is sideloading associated models. For example, each Shop has many groceries, so we can include all related groceries in /shops response: GET /shops { "shops": [ { "id": "14", "groceries": ["98", "99", "112"] } ] } When the groceries association is accessed, Ember Data will issue: GET /groceries?ids[]=98&ids[]=99&ids[]=112 { "groceries&
Before starting with setup process lets first briefly go through what Sidekiq is? and how it works? Sidekiq provides very handy and efficient way to perform most of our work asynchronously in a job. Provided Redis cache connection to it, it serializes all job parameters in Redis and deserializes it while picking it up for execution based on priority of job as it uses queue data structure to store each job in particular queue specified in job and each queue has its priority defined as high, medium, low etc. To setup Sidekiq with Redis in your application you can follow
A Symbol looks like a variable name but it's prefixed with a colon. Examples - :action Alternatively, you can consider the colon to mean "thing named" so :id is "the thing named id." You can also think of :id as meaning the name of the variable id, and plain id as meaning the value of the variable. A Symbol is the most basic Ruby object you can create. It's just a name. Symbols are useful because a given symbol name refers to the same object throughout a Ruby program. Symbols are more efficient than strings. Two
Sometimes you’ll want to refer to your image assets from inside of your JavaScript or CoffeeScript files. We have nice rails helpers that would allow us to do so but we need to append .erb to every .js or .coffee file we want to reference images. I didn’t like it that way, because ERB inside of CoffeeScript looks odd and having the file end with .erb messes up syntax highlighting. A way around this is by adding following piece of code (not the beautiful one) to one single file that ends on .erb (i.e. js_assets.js.
What do you do when you need to run the same test multiple times, but with different parameters? If you copy and paste the test, you end up with a hard-to-read test file. You can’t easily tell how the tests differ from one another. Worse, when you need to change one, you need to change them all. Take the following simple test file: def double_it(number) number * 2 end describe '#double_it' do it 'doubles 1 into 2' do expect(double_it(1)).to eq(2) end it 'doubles 2 into 4' do expect(double_it(2)