Lifehacks for web developer

    I love tricks and life hacks. Every time I rejoice when it is possible to simplify the next routine operation. And since I have been working as a web programmer for 8 years, I have programmer routines and life hacks. This is what I want to share with you.
    Some of the tricks before me have already been described on the hub; some I took from other sources, some of which I myself invented. I would be grateful if in the comments to the post you write what tricks you use.

    Usage ** in zsh


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

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

    We quickly and confidently remove garbage from the repository in the python project and frantically correct it. 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 a little harder

    Oh-my-zsh on Windows


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

    Parsing a bash expression using the explainhell.com service


    Very often I use this service. I just can’t remember the meaning of the flags. A service can explain what it consists of, for example, such a thing :
    for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l 2>/dev/null; done
    

    Quick start of the web server from the console


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

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

    PHP works too
    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
    

    For proper operation, you need the installed IIS and the path from the root.

    If this diversity was not enough, then 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 has helped me out many times. 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 still something similar, but paid.
    Pre-download the binary from the official site. We go into the binaries folder. We carry out.
    ./ngrok http 3000
    

    In response, the service will send a domain through which the application is accessible from outside.

    Using aliases on the command line to work with git.


    Oh-my-zsh has a great plugin that allows you to work with git. He also creates aliases for frequently used commands. To see the full list of abbreviations and their transcripts, you can do so.
    alias | grep git
    


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

    Goodies from comments



    ungit - a graphical interface to the git
    localtunnel.me - another thing for tying an external domain via SSH, analogue ngrok
    In bash, you can also use the syntax **, for this you need to upgrade to version 4.x Bash and include the desired option (shopt -s globstar )

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


    Also popular now: