Skip to content

Instantly share code, notes, and snippets.

View esausilva's full-sized avatar

Esau Silva esausilva

View GitHub Profile
@esausilva
esausilva / package.json
Last active December 4, 2018 14:27
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
{
"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
esausilva / FormsAndInputs.html
Last active November 16, 2018 20:36
JavaScript Snippets
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>
</form>
@esausilva
esausilva / GitBasics.md
Last active July 27, 2020 23:18
Git Basics

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 git@github.com:<<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

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
esausilva / nonascii.md
Last active August 1, 2022 22:18
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