Skip to content

Instantly share code, notes, and snippets.

View asanchezr's full-sized avatar

Alejandro Sanchez asanchezr

  • Victoria BC, Canada
View GitHub Profile
@asanchezr
asanchezr / README-Template.md
Created July 19, 2018 21:04
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@asanchezr
asanchezr / Generate 'tree' of a git repo.md
Created July 19, 2018 20:16
Displays directory paths and (optionally) files in each subdirectory.

How do I add the 'tree' command to git-bash on Windows?

Use "cmd //c tree" to use Windows' tree

Explanation:

  • Launch cmd with '/c' argument and run tree, then terminate

/C Carries out the command specified by string and then terminates

@asanchezr
asanchezr / Curl Cheatsheet.md
Last active June 13, 2021 04:07
Curl Cheatsheet

Curl Cheatsheet

TL;DR

XML GET

curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET "http://hostname/resource"

JSON GET

@asanchezr
asanchezr / Docker Cheat Sheet.md
Created July 16, 2018 20:02
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

@asanchezr
asanchezr / .bowerrc
Created July 6, 2018 22:25 — forked from AndrejsAbrickis/.bowerrc
Migrate from bower to webpack
{
"directory": "wwwroot/scripts/bower"
}
@asanchezr
asanchezr / Yarn install does not install missing modules in node_modules.md
Created June 28, 2018 22:51
Yarn install does not install missing modules in node_modules

Missing module directories in node_modules are not installed when running yarn install after you get the message "success Already up-to-date". Please note that a work around is to always run yarn install --force, however that slows down yarn install if no new modules are needed. Also everything seems to work with yarn install if the node_modules directory is deleted.

  1. Add a module (i.e. gulp-concat) through yarn -> "yarn add gulp-concat"
  2. Run "yarn install" until the quick return with "Already up-to-date"
  3. rm -rf node_modules/gulp-concat
  4. Run "yarn install"
  5. It will quick return with the message "Already up-to-date" without reinstalling gulp-concat

Answer:

@asanchezr
asanchezr / VS Code - adjust import quotes.md
Last active June 28, 2018 18:33
Visual Studio Code - Adjust import quotation setting

When working in TypeScript in Visual Studio Code, the import suggestion on a type (triggered by space + period) will generate an import using double quotes.

The TypeScript linter verifies that single quotes are used where possible.

As you can see below, the suggestion has double quotes ("@angular/...")

image

How can I adjust the setting of the import?

@asanchezr
asanchezr / Multi-Step Build for Docker.md
Created June 26, 2018 20:56
Dockerfile that builds Angular app from source, then hosts the minified code on Ngnix container
FROM node:8.6 as builder

WORKDIR /home/node/angular-seed

# copy all files not listed in .dockerignore
COPY . .

# before switching to non-root user, change ownership of home
RUN chown -R node:node .
@asanchezr
asanchezr / chocolatey-env-setup.ps1
Created June 18, 2018 18:01 — forked from amogram/chocolatey-env-setup.ps1
A Chocolatey script for PowerShell I use to set up my Windows development environment. I use this when setting up my own Dev VMs. Use at your own risk.See http://bit.ly/1a301JK and http://chocolatey.org/ for more information.
# Simple environment setup script
# Install Applications
choco install fiddler4
choco install notepadplusplus
choco install visualstudiocode
choco install greenshot
choco install GoogleChrome
choco install putty
choco install ccleaner
@asanchezr
asanchezr / Node-gyp.md
Last active June 12, 2018 19:35
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe"

https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules

There are three primary reasons you might be interested in this section:

  • you have an existing C++ library you'd like to take advantage of in your Node.js application
  • you are interested in optimizing the performance of some code by writing it in C++
  • you're running into dreaded node-gyp issues and have no idea what's going on.

Identifying native modules

How do you know if an npm package you want to install is a native module? Look for nan, node-gyp, or node-pre-gyp dependencies.