This file contains hidden or 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
| function iterationCreator(num, valueFactory, actionFactory){ | |
| for (let i = 1; i <= num; i++) { | |
| actionFactory(valueFactory(i)) | |
| } | |
| } | |
| function fizzBuzz(num){ | |
| if (num % 3 === 0 && num % 5 === 0) return 'FizzBuzz' | |
| if (num % 3 === 0) return 'Fizz' | |
| if (num % 5 === 0) return 'Buzz' |
This file contains hidden or 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
| version: "3.2" | |
| services: | |
| my-react-app: | |
| image: my-react-app | |
| ports: | |
| - "3000:80" | |
| environment: | |
| - "API_URL=https://production.example.com" |
This file contains hidden or 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
| # Generate React App | |
| create-react-app cra-runtime-environment-variables | |
| cd cra-runtime-environment-variables | |
| # Create default environment variables that we want to use | |
| touch .env | |
| echo "API_URL=https//default.dev.api.com" >> .env |
This file contains hidden or 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
| # Create directory for Ngnix configuration | |
| mkdir -p conf/conf.d | |
| touch conf/conf.d/default.conf conf/conf.d/gzip.conf |
This file contains hidden or 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
| server { | |
| listen 80; | |
| location / { | |
| root /usr/share/nginx/html; | |
| index index.html index.htm; | |
| try_files $uri $uri/ /index.html; | |
| expires -1; # Set it to different value depending on your standard requirements | |
| } | |
| error_page 500 502 503 504 /50x.html; | |
| location = /50x.html { |
This file contains hidden or 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
| gzip on; | |
| gzip_http_version 1.0; | |
| gzip_comp_level 5; # 1-9 | |
| gzip_min_length 256; | |
| gzip_proxied any; | |
| gzip_vary on; | |
| # MIME-types | |
| gzip_types | |
| application/atom+xml |
This file contains hidden or 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
| touch Dockerfile docker-compose.yml |
This file contains hidden or 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
| version: "3.2" | |
| services: | |
| cra-runtime-environment-variables: | |
| image: kunokdev/cra-runtime-environment-variables | |
| ports: | |
| - "5000:80" | |
| environment: | |
| - "API_URL=production.example.com" |
This file contains hidden or 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
| <script src="%PUBLIC_URL%/env-config.js"></script> |
This file contains hidden or 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
| #!/bin/sh | |
| # line endings must be \n, not \r\n ! | |
| echo "window._env_ = {" > ./env-config.js | |
| awk -F '=' '{ print $1 ": \"" (ENVIRON[$1] ? ENVIRON[$1] : $2) "\"," }' ./.env >> ./env-config.js | |
| echo "}" >> ./env-config.js |
OlderNewer