Skip to content

Instantly share code, notes, and snippets.

View ishida83's full-sized avatar
🌌

ishida ishida83

🌌
View GitHub Profile
worker_processes 1;
events {
worker_connections 1024;
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
@ishida83
ishida83 / .block
Created January 20, 2025 08:17 — forked from d3noob/.block
World map with zoom / pan and cities
license: mit
@ishida83
ishida83 / README.md
Created September 3, 2024 09:40 — forked from jirikuncar/README.md
Traefik - header matching

Traefik routing

Proxy to services based on Accept header.

Run

docker-compose up -d

Test

@ishida83
ishida83 / Get week number
Created December 27, 2021 04:50 — forked from IamSilviu/Get week number
JavaScript Get week number.
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
@ishida83
ishida83 / ES5-ES6-ES2017-ES2019 omit & pick
Created November 19, 2021 07:54 — forked from bisubus/ES5-ES6-ES2017-ES2019 omit & pick
ES5/ES6/ES2017/ES2019 omit & pick
​
@ishida83
ishida83 / google_translate.html
Created October 7, 2021 03:12 — forked from carolineschnapp/google_translate.html
Google Translate Embed Code
<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>
@ishida83
ishida83 / get-npm-package-version
Created May 14, 2020 09:44 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# 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
@ishida83
ishida83 / safari-nomodule.js
Created February 9, 2020 07:49 — forked from samthor/safari-nomodule.js
Safari 10.1 `nomodule` support
/**
* 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.
@ishida83
ishida83 / sse-serverside-example.js
Created January 31, 2020 08:56 — forked from akirattii/sse-serverside-example.js
Server-Sent Events nodejs example. This shows how to detect the client disconnection.
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'
};
@ishida83
ishida83 / README
Created January 22, 2020 08:26 — forked from adilapapaya/README
Export Table Data to CSV using Javascript
Example code for exporting data in a table to a csv file.