signs-not-to-be-a-programmer-sitting

Rails : Mass assignment with ids in seeds.rb |PG::UniqueViolation: ERROR

Looks like you can mass-assign records into ActiveRecord models without problem like

Category.create([
                    { parent_id: 1, name: 'Computer Science', description: 'Readable via Electronic devices.' },
                    { parent_id: 1, name: 'Electronics' },
                    { parent_id: 1, name: 'Law' },
                    { parent_id: 1, name: 'Social' }
                ])

But you cannot do like Continue reading

logo-title-dark

Redux in a nut shell

What is Redux?

Redux is a predictable state container for JavaScript apps.

In this tutorial we will create an awesome Redux app in organized fashion. But at first we will create an app in single file, analyse it and break it down to more manageable chunks of components and organize it in a comprehensible dir-structure. Continue reading

1421825741heroku-deployment

Simply Deploy React.js App to Heroku

If you have read my another post about creating a ToDo app in react you are good to go; if not see this post.

You know that React App is a single page application containing only static assets. So, you only need to setup a mechanism to serve your static assets like CSS, JS, HTML, IMAGE, etc. files when clients ask for. Either you can use market leader HTTP servers like Apache, Nginx, etc or simple Express server that runs in Node.js.

Continue reading

banner

React.js | Advanced Todo App from scratch for beginner | Bootstrap | In a nut shell

Introduction

It is a good practice to follow community standards while developing softwares. It has some major pros like

  • Its easier to understand and debug/maintain software
  • quicker to get help when needed from community
  • It will lower development cost [Money and Time]

We will be taking the convention used by this project into consideration. react-slingshot

Initialize

Make a dir called ‘todo‘ and initialize a node.js app. Continue reading

react_best_practices-1453211146748

Getting started with React.Js using NPM

My assumptions: You have prior experience of Web framework like 
  Ruby on Rails, Django, Phoenix, etc. 
Please refer to this React.js style guide for community comprehensible source code.

Hey, its not mandatory to use NPM to build applications with ReactJs; but, it will be alot easier to build, maintain, share codes using NPM. Firstly you should have NodeJs installed in your development machine.

Installation for Development Environment

$ sudo apt-get install nodejs
# try 
$ node -v
# v4.2.6
# if its says command not found: node then try 
$ nodejs
# If it shows up, it means due no some name conflicts 
# the name/command node is already taken by some binary. 
# So, its get it back.
$ sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

Probable Issues: NPM not found

Continue reading

organizing-your-small-business

Rails|Ransack|Geocoder – Sort data by distance

If your application connects local businesses to local customer, then you might have used Ransack for sorting and searching of records. For geocoding and reverse-geocoding, you might be using Geocoder gem. If you want to let users to sort results by distance then its pretty easy.

Things to remember,

  • If you use Model.near([lat, long]) method, Ransack adds a new column called distance to the ActiverecordRelation object. You can access the method distance by prying.

Continue reading

rating