Tuesday, 19 April 2016
Monday, 18 April 2016
New way to do php development
Guys, on windows we all use WAMP(Windows, Apache, Mysql, PHP) software stack, while linux users use LAMP stack. But if you're familiar with python or ruby on rails development. They provide inbuilt server for development.. Like python provides SimpleHTTPServer and ROR provide Webrick .... but we use the old school way of development in php. There is a inbuilt server in php which we can use to increase our productivity.
Just move to the directory via terminal and run the following command
That's it, enjoy!
Just move to the directory via terminal and run the following command
That's it, enjoy!
Saturday, 16 April 2016
Python SimpleHTTPServer does not serve SVG! [Solved]
I was testing one of my web projects in mobile devices and i encountered this problem that it's not serving svg i generated using adobe illustrator! There is problem in mime types in current SimpleHTTPServer. So i'm posting code for a modified version of python SimpleHTTPServer that serve's SVG images :D
That's it. Enjoy!
EDIT => 26 October 2016
hey guys i was learning nginx webserver and i learned about mime-types there so i thought to add some more information here. MIME basically is shortform of Multi-Purpose Internet Mail Extensions. This is basically a file in nginx which has a list of two column values which contains extensions(pdf, svg, jpeg, png, mp3, mp4) and content-type(application/pdf, image/svg+xml etc ..) so if in the servers mime-types file there is no mentioned extention with content-type then its defaults to content-type: application/octet-stream. So in the above case python SimpleHTTPServer does not has extension svg and corresponding content-type: application/svg+xml in its mime-types file that's why its defaults to content-type: application/octet-stream and instead of rendering in browser it downloads.
That's it. Enjoy!
EDIT => 26 October 2016
hey guys i was learning nginx webserver and i learned about mime-types there so i thought to add some more information here. MIME basically is shortform of Multi-Purpose Internet Mail Extensions. This is basically a file in nginx which has a list of two column values which contains extensions(pdf, svg, jpeg, png, mp3, mp4) and content-type(application/pdf, image/svg+xml etc ..) so if in the servers mime-types file there is no mentioned extention with content-type then its defaults to content-type: application/octet-stream. So in the above case python SimpleHTTPServer does not has extension svg and corresponding content-type: application/svg+xml in its mime-types file that's why its defaults to content-type: application/octet-stream and instead of rendering in browser it downloads.
Friday, 18 March 2016
Rails => adding, removing index and foreign key => Order
Go through this order
- Add index
- Add foreign key
Then in down method do opposite i.e.
- Remove foreign key
- Remove index
Wednesday, 16 March 2016
Enabling mouse scroll in TMUX
One of the problems i encountered while using tmux is the mouse scroll ain't working few months ago and i never tried to google how to fix that. Today after getting quite frustated i finally googled and found out this simple solution to enable mouse scroll in tmux ... Just press Ctrl + b and then press : (colon). After this a small orange color bar pops up in the bottom and there you have to write the following command "setw -g mode-mouse on" without quotes.
That's it!
That's it!
Monday, 15 February 2016
Sunday, 31 January 2016
Changing hostname in vagrant!
hostnames in ubuntu/trusty64 are quite long like shown in the image below!
hostname in above pic is vagrant-ubuntu-trusty-64 and i fucking hate this long hostname so all you can do is run the command as shown in the pic below to change the hostname.
After doing this restart the terminal and this is what you get
and yes if you like my agnoster theme then check here how to do this.
EDIT:-> above method temporarily adds hostname for permanent changing the hostname you have to edit the hostname file present in the /etc/ directory.. just open it and remove the old hostname and add the new hostname.
hostname in above pic is vagrant-ubuntu-trusty-64 and i fucking hate this long hostname so all you can do is run the command as shown in the pic below to change the hostname.
After doing this restart the terminal and this is what you get
and yes if you like my agnoster theme then check here how to do this.
EDIT:-> above method temporarily adds hostname for permanent changing the hostname you have to edit the hostname file present in the /etc/ directory.. just open it and remove the old hostname and add the new hostname.
Subscribe to:
Posts (Atom)