Skip to content

Instantly share code, notes, and snippets.

@amer1616
amer1616 / vi_common_commands
Last active August 6, 2020 11:00
vi common commands
i - Insert at cursor (goes into insert mode)
a - Write after cursor (goes into insert mode)
A - Write at the end of line (goes into insert mode)
ESC - Terminate insert mode
u - Undo last change
U - Undo all changes to the entire line
o - Open a new line (goes into insert mode)
dd - Delete line
3dd - Delete 3 lines.
@amer1616
amer1616 / DomHelpers.js
Created May 6, 2020 02:20
Js DOM helpers
const $ = function $ (selector, context = document) {
const elements = Array.from(context.querySelectorAll(selector))
return {
elements,
html (newHtml) {
this.elements.forEach(element => {
element.innerHTML = newHtml
})
pwd: know the directory in which you're located
cd: change directories
navigate to Desktop - cd ~/Desktop
navigate to home directory - cd /
navigate up one level from the current directory - cd ..
navigate to multiple level of directory - cd /var/www
ls: list the current directory content