Giter VIP home page Giter VIP logo

developing_in_a_black_hole's Introduction

Developing

in a black

hole

http://github.com/javiacei/developing-in-a-black-hole http://github.com/javiacei/dotfiles

Vim

Vim, Vi IMproved, is a power open-source text editor

  • Awesome documentation (:help)
  • Huge community
  • Extensible, customizable and portable

Modes

  • Normal esc
  • Visual v
  • Insert i
  • Command-line :!

Navigation

  • Movement keys: h, j, k, l
  • Forward, back: w, b
  • Move multiplier <number><movement>
  • Go to the beginning of current line 0 and to the end $
  • Go to the beginning of the file gg and to the end G
  • Go to line :<linea>
# Example
from django.db import models

class Vehicle(models.Model):
  mma = models.DecimalField(max_digits=10, decimal_places=2, null=True)
  length = models.DecimalField(max_digits=10, decimal_places=2, null=True)
  model = models.CharField(max_length=200, null=True, blank=True)

Actions

  • Insert at the end of the current line A
  • Add a new line below o and above O
  • Change text c + <movement>
  • Copy y + <movement> and paste p
  • Delete d + <movement>
  • Undo u and redo c-r
  • Autocomplete c-n
  • Repeat the last executed command .
# Example
from django.db import models

class Vehicle(models.Model):
  mma = models.DecimalField(max_digits=10, decimal_places=2, null=True)
  length = models.DecimalField(max_digits=10, decimal_places=2, null=True)
  model = models.CharField(max_length=200, null=True, blank=True)

Search

  • Search inside current line f<character> (forward), F<character> (back)
  • Search inside current file /
  • Search selected word *
  • Search and replace :%s/<search>/<replace>
# Example
from django.db import models

class Vehicle(models.Model):
  mma = models.DecimalField(max_digits=10, decimal_places=2, null=True)
  length = models.DecimalField(max_digits=10, decimal_places=2, null=True)
  model = models.CharField(max_length=200, null=True, blank=True)

Selection

  • In visual mode v
  • Block selection c-v
# Example
from django.db import models

class Incident(models.Model):
    INCIDENT_ACTIONS = (
        (ASSIGN_DRIVER, 'Assign driver'),
        (UNASSIGN_DRIVER, 'Unassign driver'),
        (UPLOAD_CARGO_MANIFEST, 'Upload cargo manifest'),
        (DELETE_CARGO_MANIFEST, 'Delete cargo manifest'),
    )

    action = models.CharField(max_length=30, choices=INCIDENT_ACTIONS, default=ACTION_OTHER)

Macros

  • Create a new macro q + <macro register>
  • Apply macro @ + <macro>
# Example
from django.db import models

class Incident(models.Model):
    INCIDENT_ACTIONS = (
        (ASSIGN_DRIVER, 'Assign driver'),
        (UNASSIGN_DRIVER, 'Unassign driver'),
        (UPLOAD_CARGO_MANIFEST, 'Upload cargo manifest'),
        (DELETE_CARGO_MANIFEST, 'Delete cargo manifest'),
    )

    action = models.CharField(max_length=30, choices=INCIDENT_ACTIONS, default=ACTION_OTHER)

Functions

  • Execute vim functions with :
  • :write, :w, :quit ,:q, :edit, :e
  • Execute command line :!

Panels, Tabs

  • Horizontal :split :sp and vertical :vsplit :vsp panels
  • Tabs :tabe. Navigate with gt and Gt

Plugins

  • vundle
  • nerdtree
  • ctrlp
  • ack
  • vim-tmux-navigator
  • vim-snippets
  • vim-flake8
  • vim-numbertoggle

Tips

  • Learn to speak Vim (see resources)
  • Create your own configuration
  • Search and try plugins, but ...
  • Install those you are going to use
  • Keep calm and be patient

Resources

Tmux

tmux is a client-server terminal multiplexer that lets you switch between several programs in one terminal.

Windows

  • Create windows <leader> + c
  • Rename windows <leader> + ,
  • Navigate between windows <leader> + w, <leader> + number

Panels

  • Create horizontal <leader> + - and vertical <leader> + | panels
  • Resize panel <leader> + L and <leader> + H
  • Remove panel <leader> + x
  • Zoom panel <leader> + z
  • Navigation <leader> + q and like vim using vim-tmux-navigator

Navigation

  • Enter in navigation mode <leader> + [
  • Same vim commands to navigate
  • Search / and navigate between searches n y N

Sync

  • Panels syncronization <leader> + : and set property :setw synchronize-panes

Pair Prog

  • Create a named session in detached mode tmux new-session -s pair -d
  • Connect to a named session tmux attach-session -t pair

Tips

  • Change tmux leader to c-a mapping caps lock key to control
  • Configure your own tmux in ~/.tmux.conf
  • Use and configure vim-tmux-navigator

Resources

HTTPie

Command line HTTP client to make interaction with web services as human-friendly as possible

  • Command http to make requests
  • JSON highlighting
  • Provide query params ==
  • JSON by default =, :=, @=
  • Set headers Header:Value
  • Sessions

Using curl

Using curl ...

curl -X POST -H "Accept: application/json"
-H "Content-type: application/json"
-d '{"grant_type":"password","client_id":"<client_id>","username":"","password":""}' \

curl -H "Accept: application/json"
-H "Content-type: application/json"
-H "Authorization: Bearer " \

Using httpie

http POST grant_type=password client_id=<client_id> username= password= http "authorization: Bearer " (and with --session= to save the session)

jq

jq is a command line JSON processor

  • Simple syntax
  • JSON highlighting
  • Lots of pipe filters

Demo

jq '(.results | limit(3;.[]) | [.origin, .destination] | join(" -> "))'

Thanks!

Francisco Javier Aceituno [email protected] http://github.com/javiacei

Software Engineer in OnTruck

We will move 1.000.000 trucks with python, join us! [email protected]

developing_in_a_black_hole's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aeroaks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.