(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| var amqp = require('amqplib/callback_api'); | |
| // if the connection is closed or fails to be established at all, we will reconnect | |
| var amqpConn = null; | |
| function start() { | |
| amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) { | |
| if (err) { | |
| console.error("[AMQP]", err.message); | |
| return setTimeout(start, 1000); | |
| } |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.
Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.
$ git remote add staging https://git.heroku.com/staging-app.git
| #!/bin/bash | |
| # | |
| # ----------------------- | |
| # | |
| # This is a script that installs docker-ce (Docker Community Edition) on Debian 9 | |
| # Inspired by https://gist.github.com/frgomes/a6f889583860f5b330c06c8b46fa0f42 | |
| # | |
| # ----------------------- | |
| # Pre-requesite |
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
I will be using the root user, but would suggest creating a new user
| export function autoUnsubscribe(subscriptions: string[] = []) { | |
| return (componentType) => { | |
| const orgFactory = componentType.ngComponentDef.factory; | |
| componentType.ngComponentDef.factory = (...args) => { | |
| const component = orgFactory(...args); | |
| componentType.ngComponentDef.onDestroy = () => { | |
| if (component.ngOnDestroy) { | |
| component.ngOnDestroy(); |