Skip to content

Instantly share code, notes, and snippets.

# Get Nginx image from Docker hub
FROM nginx
# Copy our configuration file to a folder in our Docker image where Nginx will use it
COPY default.conf.template /etc/nginx/conf.d/default.conf.template
# Configure Nginx for Heroku
CMD /bin/bash -c "envsubst '\$PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf" && nginx -g 'daemon off;'
# Update available packages in Debian
RUN apt-get update
# Install curl cmd line tool
RUN apt-get install curl -y
componentDidUpdate() {
if (this.state.members === '' || this.state.members === undefined) {
this.props.fetchHousingGovernmentMembers();
}
if (this.state.members !== this.props.members) {
this.setState({ members: this.props.members });
}
// exec allows us to run cmd commands in code
const { exec } = require('child_process');
// process.env.PORT is defined by Heroku environment. Use 3200 as fallback if outside of Heroku.
const port = process.env.PORT || 3200;
console.log('Port: ' + port)
const cmdStr = `.\\node_modules\\.bin\\serve -l ${ port} ./build`
console.log(cmdStr)
import React, { useState } from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
const [response, setResponse] = useState('')
return (
<div className="App">
// Comes with Node
const http = require('http');
// Access dynamic Heroku port with process.env.PORT. 3001 is a fallback.
const port = process.env.PORT || 3001;
// Create a server
const server = http.createServer((req, res) => {
// If call was made to /hello-world pathname. We aren't using REST here!
if (req.url === '/hello-world') {
// execSync allows us to run system commands synchronously
const { execSync } = require('child_process');
// process.env.PORT is defined by Heroku environment. Use 3200 as fallback if outside of Heroku.
const port = process.env.PORT || 3200;
// Same as runnin "npm run serve" in terminal
execSync(`npm run serve -- -l ${ port} ./build`, (err, stdout, stderr) => {
if (err) {
// node couldn't execute the command
<div
ng-include="'list-group-item-actions-toggle-button'"
ng-repeat="item in [person]"
>
sisältöä
</div>
sudo find / -iname *.app > ~/Desktop/EveryMacDotApp.txt
"use strict";
var WebSocketServer = require('ws').Server
, wss = new WebSocketServer({ port: 8080 });
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'password',