Proxy to services based on Accept header.
docker-compose up -d
| worker_processes 1; | |
| events { | |
| worker_connections 1024; | |
| } | |
| http { | |
| map $http_upgrade $connection_upgrade { | |
| default upgrade; | |
| '' close; |
| license: mit |
| Date.prototype.getWeek = function () { | |
| var onejan = new Date(this.getFullYear(), 0, 1); | |
| return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7); | |
| }; | |
| var myDate = new Date("2001-02-02"); | |
| myDate.getWeek(); //=> 5 |
| β |
| <div id="google_translate_element"></div> | |
| <script> | |
| function googleTranslateElementInit() { | |
| new google.translate.TranslateElement({ | |
| pageLanguage: 'en' | |
| }, 'google_translate_element'); | |
| } | |
| </script> | |
| <script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> |
| # Version key/value should be on his own line | |
| PACKAGE_VERSION=$(cat package.json \ | |
| | grep version \ | |
| | head -1 \ | |
| | awk -F: '{ print $2 }' \ | |
| | sed 's/[",]//g') | |
| echo $PACKAGE_VERSION |
| /** | |
| * Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will | |
| * load <script nomodule> anyway. This snippet solve this problem, but only for script | |
| * tags that load external code, e.g.: <script nomodule src="nomodule.js"></script> | |
| * | |
| * Again: this will **not** prevent inline script, e.g.: | |
| * <script nomodule>alert('no modules');</script>. | |
| * | |
| * This workaround is possible because Safari supports the non-standard 'beforeload' event. | |
| * This allows us to trap the module and nomodule load. |
| var express = require('express'); | |
| var app = express(); | |
| // response header for sever-sent events | |
| const SSE_RESPONSE_HEADER = { | |
| 'Connection': 'keep-alive', | |
| 'Content-Type': 'text/event-stream', | |
| 'Cache-Control': 'no-cache', | |
| 'X-Accel-Buffering': 'no' | |
| }; |
| Example code for exporting data in a table to a csv file. |