📜 ⬆️ ⬇️

Life hacking for web developer

I love tricks and life hacking. Every time I am glad when I manage to simplify the next routine operation. And since I have been working as a web programmer for 8 years now, I have programmer routine operations and life hacking. This is what I want to share with you.
Some of the tricks before me have already been described in Habré, some I took from other sources, some I invented myself. I would be grateful if in the comments to the post you write what tricks you use.

Using ** in zsh


Thus, I search for files in a folder by extension recursively:
ls **/*.json 

Files larger than 1 megabyte:
 ls -lh **/*(Lm+1) 

Quickly and confidently remove garbage from the repository in the python project and convulsively rule. gitignore:
 git rm --cached **/*.pyc 



Generation. gitignore using the gitgnore service. io


New team first
  git config --global alias.ignore '!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi' 

and now we can generate our own file. And no more pyc files!
 git ignore sass,node,python,django 

Windows users are a bit more complicated.
')

Oh-my-zsh on windows


If you do not want to read the section from the previous trick about Windows for reasons not related to the use of other operating systems, then for you I have a pleasant surprise .
Babun is quite a decent implementation of a terminal emulator. Of the benefits: integration with oh-my-zsh and package manager.

Parsing bash expressions using the service hehellhell.com


Very often I use this service. I can not remember the meaning of flags. The service can explain what it is like, for example:
 for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l 2>/dev/null; done 

Quick start web server from console


To start the web server with the root of the current folder:
 python -m SimpleHTTPServer 8000 

or install BrowserSync
 npm i -g browser-sync && browser-sync start --server 

PHP also works
 php -S 127.0.0.1:8000 

and ruby:
 ruby -run -e httpd -- -p 5000. 

and for lovers:
 C:\> "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:C:\MyWeb /port:8000 

To work properly, you need an installed IIS and a path from the root.

If this diversity is not enough, you can always find more

Show the client the result of their work, from their computer in the absence of a dedicated IP


This thing rescued me many times. It works on top of SSH, creates a subdomain by which the client can see your web application. It works quite slowly. But it works. This is the main thing. There is something similar, but paid.
Pre-download the binary from the official site. Go to the folder with the binary. We carry out.
 ./ngrok http 3000 

In response, the service will send the domain for which the application is available from outside.

Using command line aliases to work with git.


Oh-my-zsh has a great plugin that allows you to work with git. It also creates aliases for frequently used commands. To view a complete list of abbreviations and their transcripts can be done like this.
 alias | grep git 


This is only a small part of what I really use. If this topic is interesting, I will definitely write the second part.

Goodies from the comments



ungit - GUI with git
localtunnel.me - one more thing for linking an external domain via SSH, an analogue of ngrok
In bash, you can also use the syntax **, for this you need to update the version of Bash to 4.x and enable the necessary option (shopt -s globstar)

Update 1: fixed bugs, now everything should work fine
Update 2: Added a section with user hacks

Source: https://habr.com/ru/post/267751/


All Articles