Posts

Uninstall docker and rerun docker on ubuntu 16.04

If you copy paste the following lines into the terminal of your ubuntu, it will automatically uninstall docker and reinstall it for you. This is clean sweep of your docker setting files. This is very handy when docker has gone beserk and you want to clean it up.

sudo service docker stop && sudo apt-get purge -y docker-engine && sudo apt-get autoremove — purge -y docker-engine && sudo rm -rf /var/lib/docker && sudo apt-get update && sudo apt-get install -y docker-engine && sudo service docker start && sudo docker run hello-world && sudo usermod -aG docker $USER
 Source: https://gist.github.com/gten/2eac49482def3fad647b66521b77593e


Thanks for your support and appreciation.

You can also follow me at Twitter, Facebook, LinkedIn and Website.

Ruby on Rails 5 - 204 No Content - Why this change makes sense for you?

Image
Note: This is a change that is present in the latest Rails version 5. Versions before the 5 will throw an error "MissingTemplate" exception.

In Ruby on Rails 5, there is a change that is particularly important. Rails server issues a HTTP code of 204 No Content when you request a POST method without a template but the action for the same is present. This happens only when the HTTP Verb is POST and it doesn't happen for GET requests.
This is the sample code for the action which will be called as POST:
def create   @user = User.new(params[:user]) end
So how does this help you? Now you can write your own POST actions which can be called via Ajax calls which will automatically get a success response because of the 204 http code and you can let your javascript handle the changes on the UI.GET via browser will throw an error. This is because Rails assumes that you have to have a template for showing some content to the user. Any disadvantages? Your html page after the POST reques…

Minimize your nodejs docker image size with these hacks

Image
Note: If you are developing and deploying applications using node.js and docker, this is a post you must not miss.




Docker images have layered filesystems which the docker engine automatically reuses from other images if they are similar. So, in order to even save more filesize from your images, you can follow these steps:
1. Use alpine images Docker images usually come with an alpine image as well. Alpine images are stripped down linux kernel which has nothing but a barebones OS container in it. I would be writing more about the alpine linux in a future post. But the images of alpine linux do not exceed 5 MB which is a huge life saver when you shipping images to and fro your teams and to production.
Node has a alpine version from its official repository with various versions that are tagged. You can have a look at https://hub.docker.com/r/mhart/alpine-node/
Please be aware that they are just plain node and it will not even contain npm. You can install npm within it as required and the…

node.js npm install --save. What does the --save mean?

Image
Have you ever wondered what does "--save" does in the npm install command?

It adds a line into the dependencies.json file of the current project with package name which you are trying to install and saves you a few manual labor of writing it yourself.

Try it out yourself.

$ npm install sequelize --save

ssh-copy-id using a different/custom port

Image
Have you ever created your own cloud server and changed your ssh port from the default 22 to something else? And have you ever tried to use ssh-copy-id to copy your local ssh public key to the remote and it doesn't work?

The answer is simple. There are no parameters that you can provide for ssh-copy-id command. Instead do the following:

ssh-copy-id -i id_rsa.pub "user@domain.com -p 12345" That's it. It should work without a problem.

Periodic table of HTML Elements #for #fun

Image
This is a fun way to present the html tags as a periodic table! Click on the element to know a little description about it!

Go here: http://joshduck.com/periodic-table.html

[Screenshot below]



Sublime 2 Keyboard Shortcuts

Image
Sublime Text 2 – Useful Shortcuts (PC)Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation. EditingCtrl+Ccopy current line (if no selection)Ctrl+Xcut current line (if no selection)Ctrl+⇧+Kdelete lineCtrl+↩insert line afterCtrl+⇧+↩insert line beforeCtrl+⇧+↑move line (or selection) upCtrl+Lselect line (repeat to select next lines)Ctrl+Dselect word (repeat select others occurrences in context for multiple editing)Ctrl+Mjump to closing bracket for current code, repeat to jump to opening bracketCtrl+⇧+Mselect all contents of the current brackets (curly brackets, square brackets, parentheses)Ctrl+KKdelete from cursor to end of lineCtrl+K+⌫delete from cursor to start of lineCtrl+]indent current line(s)Ctrl+[un-indent current line(s)Ctrl+⇧+Dduplicate line(s)Ctrl+Jjoin line below to the end of the current lineCtrl+ /comment/un-comment current lineCtrl+⇧+/block comment current selectionCtrl+Yredo, or repeat last keyboard shortcut commandCtrl+⇧+Vpa…