View trim.php
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
echo trim($str, "\xC2\xA0"); |
View index.html
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
<% for (var i in htmlWebpackPlugin.files.css) { %> | |
<link href="<%= htmlWebpackPlugin.files.css[i] %>" rel="stylesheet"> | |
<% } %> |
View webpack.config.js
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
require('dotenv').config({ path: path.resolve( __dirname, '../../.env' ) }); | |
module.exports = { | |
... | |
plugins: [ | |
new HtmlWebpackPlugin( { template: './src/index.html' } ), | |
new webpack.DefinePlugin( { |
View create-root-ca.sh
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
#!/bin/bash | |
# file: selfsigned.csr.conf | |
# --------------------------- | |
# [req] | |
# default_bits = 2048 | |
# prompt = no | |
# default_md = sha256 | |
# distinguished_name = dn |
View make-selfsigned-cert.sh
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
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \ | |
-keyout selfsigned.key -out selfsigned.crt -extensions san -config \ | |
<(echo "[req]"; | |
echo distinguished_name=req; | |
echo "[san]"; | |
echo subjectAltName=DNS:localhost,DNS:example.net,DNS:www.example.net,IP:10.0.0.1 | |
) \ | |
-subj "/CN=example.com" |
View server_url.php
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
$full_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; |
View cors-headers.php
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
$origin = $_SERVER['HTTP_ORIGIN']; | |
$allowed_domains = [ | |
'http://localhost', | |
'http://localhost:8080', | |
'http://localhost:8081', | |
'https://example.com', | |
'https://test.example.com', | |
'http://example.net', | |
]; |
View source-env.sh
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
set -o allexport; | |
. ./.env; | |
set +o allexport | |
# echo $VAR_NAME |
View webpack.config.js
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
const WebpackAssetsManifest = require( 'webpack-assets-manifest' ); | |
const manifest = new WebpackAssetsManifest( { | |
transform( assets, manifest ) { | |
assets["version" ] = new Date().getTime().toString(); | |
}, | |
} ); |
View datetostr.js
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
const dateToStr = (input) => { | |
if (input.length !== 6) { | |
return "wrong date syntax, use YYYYMM"; | |
} | |
const parts = input.match(/([0-9]{4})([0-9]{2})/); | |
if (!parts) { | |
return "wrong date syntax, use YYYYMM"; | |
} | |
NewerOlder