This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
function App() { | |
const [response, setResponse] = useState('') | |
return ( | |
<div className="App"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div | |
ng-include="'list-group-item-actions-toggle-button'" | |
ng-repeat="item in [person]" | |
> | |
sisältöä | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo find / -iname *.app > ~/Desktop/EveryMacDotApp.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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', |
NewerOlder