In recent days, UI Components have become building blocks of a website or an application. And these UI Components need to be examined and tested properly before building User Interfaces.
While recording a live video on a browser, have you ever wondered how to convert videos from different browsers into one standard format? There are multiple challenges during audio-video compression, conversion, editing etc., especially with respect to quality and size of the file.
Have you ever wanted a quick code look up for sorting by columns in a table using Backbone.js? Also sorting those in ascending and descending orders? Then, you are at the right place!
Android uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. One of the most important file in Android application development is
build.gradle, which is used in the process of building an android app.
Let’s see how we can configure android builds with
Recently while writing specs for a Phoenix application, I came across this scenario, where I needed to pass a
jwt token in
request-headers for authorization of Users.
Use conditional config to separate gitconfig for work and personal projects.
Creating elegant custom exceptions is easy with ecmascript classes.
class properties in ES7 can be used to write elegant React components.
Method#to_proc - just like
FactoryGirl’s traits are an outstanding way to
DRY up your tests and factories.
How to use transient_attributes?
In the latest version of Android, Nougat 7.1 (API 25), Google introduced a new feature called App Shortcut. This allows you to create shortcut for specific action or screen in your app that can be opened directly from launcher to associated screen.
With the introduction of Material Design, motion and animations became the integral part of Android applications. To make the development easier, Google introduced a new Android Design Support Library. This lets developers focus on the features that make their applications unique rather than focusing on animations part.
ActionController::ParamsWrapper in Rails is responsible for wrapping the parameters hash into a nested hash.
Today I came across pgcli. It is a database console for postgres with
syntax highlighting and more importantly
Debugging and testing Push notification is always tricky and time consuming.
Knuff OS X app along with Knuff iOS app can make our lives a little easier to debug and test push notification.
ActiveRecord comes with a mechanism to track changes to your model with
ActiveModel::Dirty. Lets put it to some use.
Ever wondered how you can do each iteration of a
for loop with some delay? That means, the code block in
for loop body will be executed until the condition goes wrong, but with a delay in each iteration.
As we are familiar with MVC design pattern and it is one of the standard approach to build iOS Applications. MVVM is very similar to MVC. It formalizes the tightly coupled nature of the view and controller and introduces a new component
In many native iOS applications, webviews are used to perform certain tasks. Once the initial urls is set to webview, it becomes difficult to intercept redirection url(if any), which is handled by webview. But sometimes we need to intercept these urls to perform specific actions.
A new array can be created by using two different ways in ruby and can contain different types of objects.
Observer pattern provides a simple mechanism for one object to inform a set of interested objects when its state changes.
All migration files in
Rails are by default prefixed with the timestamp which serves as the version number for the migration file. For an instance a migration file with name
20160310141700_create_users.rb is prefixed with timestamp
While validating one of the many forms, I came accross a situation where a form field’s presence was dependent on another DOM element,
depends property of
jquery-validate plugin came to resue.
Got some hidden fields in a form which needs validation(at some later point say, when made visible)? Lets learn how to remove or add validation rules dynamically using jQuery Validate plugin.
This is in continuation with the ArrayInquirer post.
Lets see how to implement a
Custom Inquirer for a
Rails model similar to
ActiveSupport StringInquirer and ArrayInquirer.
React-Native has a pretty ordinary progressbar which does not allow a lot of customizations,
but creating your own with animations is fairly simple.
Almost every projects contains Utility Functions. With the introduction of Swift, there are multiple ways to write such functions.
defer is a new keyword indroduced in Swift 2.0. With this statement you can declare clean-up code, that is executed just before the current scope ends.
SwiftLint is a tool which enforce to follow Swift style and conventions, based on GitHub’s Swift Style Guide.
Do you know, you can’t bind mouse events to a input element once it is disabled?
Get the diff of files/directories using git difftool.
Apple had added a new feature to the protocol i.e. protocol extension.While it may only seem like a minor feature at first, but this improved feature in swift allow us for a new type of programming i.e. protocol-oriented programming.
Avoiding a third party redirect can be solved with simulation of user browser actions.
In my previous post, I have explained how to extend
In this post, I will explain how to extend core
rails classes in
CSS animations make it possible to animate transitions from one CSS style configuration to another.
The intent of decorator design pattern, as described in
Design Patterns by the Gang of Four is to
attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
To start testing with Espresso, first you need to add the espresso dependency in your
app level build.gradle.
In Objective-C Xcode generate compile time warning by using
#warning preprocessor directive in your code. Unfortunately, this is not available when using Swift.
Recently while working on one of the projects I encountered a situation where I had to post some nested-data to a controller method and this data wasn’t associated with any model hence rails
fields_for was of no help.
I generally use
jquery-validate plugin for frontend validations. It comes with handful of validator methods. Sometimes we need custom validations. Lets see how to add one.
Devise by default redirects the user to the previous url (if present) after authenticating. This is a very useful default to have. But this behaviour is lost if we override the
after_sign_in_path_for method in our application.
I had a huge directory that was to be shared with my client and I was having a limited internet access. I came across this interesting project. I downloaded the required version on the server,
chmod +xed it and ran
gdrive about. It asked me to get a token from the web by pasting a generated URL. I ran
gdrive list and voila, I could see all my Drive files listed in the terminal.
Last night I was watching Sandi Metz’s podcast on Bikeshed and one question in the QnA striked me.
In some widgets rich websites we are often faced with a situation where we need to update all the widgets on a page based on change of a particular attribute.
ActiveSupport::Inflector handles a lot of the semantic rules in Rails, including acronyms.
Database is considered an expensive resource, and while developing our application we should be particular about the number of DB queries made, in general fewer the DB queries executed, the better the performance.
In this post, lets see how to extend
ActiveRecord::Base class to add custom methods.
Ruby 2.4 has optimized
Array#max methods. Here are some benchmarks.
Gravatar URL’s are generated by creating a
hash from your
email address. Here we are going to create a
liquid-filter for this.
It is often required to extend existing object or class to add new methods or override existing methods. Almost All the Object Oriented Programming Languages provide this feature using inheritance.
ActiveRecord classes is quite handy. Here we will learn creating
FactoryGirl for NonActiveRecord classes.
You dont have to put the
& symbol to put the process in background. It will work without that. Sample configuration:
I never knew this exisited. It seems it is not documented anywhere and I have no idea how it works, but yes:
Rspec has a pretty handy feature called predicate matchers to test predicate methods on your classes.
Sass mixins are pretty handy if you want to re-use same snippet of css at multiple places. But did you know they can act like functions as well?
If we have click events bound to elements inside a bootstrap modal, clicking on the element closes the modal. Here is a trick to prevent that.
ActiveRecord enums are really handy but they can be equally evil if not used properly.
Spying is used to assert if a method has been called, here we will see how to use spies with Rspec.