Skip to content

Instantly share code, notes, and snippets.


Esau Silva esausilva

View GitHub Profile
esausilva / package.json
Last active Dec 4, 2018
Webpack config to compile JS and Sass files. (In Visual Studio )Using "NPM Task Runner" to run "dev" script when project opens and "build" script before each build
View package.json
"name": "fullcalendar-core",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack --watch",
"build": "cross-env NODE_ENV=production webpack"
"author": "Esau Silva (@_esausilva)",

Find running processes

$ ps aux | less

Find process running in a specific port

$ lsof -i tcp:[PORT]
esausilva / FormsAndInputs.html
Last active Nov 16, 2018
JavaScript Snippets
View FormsAndInputs.html
Forms and inputs are available via properties on document.forms. You might not need a selector
<form name="norm">
<input type="text" name="first" value="wes">
<input type="checkbox" name="toppings" value"pickles">
<input type="checkbox" name="toppings" value"mustard" checked>
<input type="checkbox" name="toppings" value"hot sause">
<input type="checkbox" name="toppings" value"cheese" checked>

Git Basic Commands

$ git init                               # initializes the repo. need to be at the root of the project
$ git add . OR git add -A                # all all the files, staged 
$ git status                             # shows all the files that are ready to be committed; staged
$ git commit -m 'first project version'  # initial commit
$ git remote add origin<<username>>/<<repository_name>>	# sets up GitHub as the origin for the master branch
$ git remote -v                          # shows remote origin
$ git push -u origin master              # this pushes the repo into GitHub. always push the origin master. Only first time push
View Get Latest Code Version -

Get Latest Code Version - Git

Case 1: Don’t care about local changes

  • Solution 1: Get the latest code and reset the code
git fetch origin
git reset --hard origin/[tag/branch/commit-id usually: master]
esausilva /
Last active Oct 7, 2020
Find non-ASCII characters

One-liner for finding non-ASCII characters

# Linux
$ grep --color='auto' -P -n "[\x80-\xFF]" file.js

# Mac OS X after 'brew install pcre'
$ pcregrep --color='auto' -n "[\x80-\xFF]" file.js