Skip to content

dstuff/angular-code-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

angular-code-snippets

Some useful code snippets for Angular.io

GPS coordinates validator function

private coordinatesValidator(option: string) {
    return (control: FormControl): { [key: string]: any } | null => {
      const value: string = control.value;
      const regex =
        option === 'lat'
          ? /^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,6})?))$/
          : /^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,6})?))$/;
      const parsedValue = !regex.test(value);
      return parsedValue
        ? { invalidCoordinates: { coordinates: value } }
        : null;
    };
  }

Docker cheatsheet

Examples of the dev Dockerfile and docker-compose for the development environment. It assumes that your Dockerfile and docker-compose located at the same directory as the app root.

Launch container from docker-compose file

docker-compose up --build -d --force-recreate

List images and containers

docker ps -a or docker container ls -a

Show list of all containers (-a). You can skip -a option to show only running.

docker images -a

Show list of all (-a) images

Remove images and containers

Remove all unused images:

docker image prune -a -f

Removes all (-a) unused images without confirmation (-f)

Remove all stopped containers:

docker container prune -f

Run terminal on detached active container

Launch interactive terminal:

docker exec -it 466a13554655 /bin/sh

Exit interactive terminal:

exit

About

Some useful code snippets for Angular.io

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published