parceljs - jQuery is undefined jquery-ui
//
import jQuery from "jquery";
window.$ = window.jQuery = jQuery;
import "jquery-ui-bundle";
// or something like, as suggested thoughout the internets
import $ from 'jquery';
/** | |
* FNV hash | |
* - 32 bit FNV-1a hash | |
* - 64 bit FNV-1a hash | |
* @link http://isthe.com/chongo/tech/comp/fnv/ | |
* | |
* Usage: | |
* fnv.hash('Hello World', 32) // 3012568359 | |
* fnv.hash('Hello World', 64) // 3599595964 | |
*/ |
// derive string key | |
async function deriveKey(password) { | |
const algo = { | |
name: 'PBKDF2', | |
hash: 'SHA-256', | |
salt: new TextEncoder().encode('a-unique-salt'), | |
iterations: 1000 | |
} | |
return crypto.subtle.deriveKey( | |
algo, |
<VirtualHost *:80> | |
ServerName example.com | |
ErrorLog /var/log/httpd/example.com-error.log | |
CustomLog /var/log/httpd/example.com-access.log combined | |
ProxyRequests Off | |
ProxyVia Block | |
ProxyPreserveHost On | |
<Proxy *> |
parceljs - jQuery is undefined jquery-ui
//
import jQuery from "jquery";
window.$ = window.jQuery = jQuery;
import "jquery-ui-bundle";
// or something like, as suggested thoughout the internets
import $ from 'jquery';
https://freegeoip2.azurewebsites.net/Home/Resolve | |
https://freegeoip2.azurewebsites.net/Home/Resolve/123-123-123-123 |
/** | |
* Traverse over an object, safe from [Circular] | |
* | |
* - if value is string or number, returns value | |
* - if value is function, returns array of function arguments | |
* - if value is anything else, returns empty string | |
* | |
``` javascript | |
let test = { |
/** | |
* Strict merge | |
* | |
* Recursive merge two arrays or objects where the first is the | |
* constraint, so if item/value in B is not in A or is not the | |
* same type as A then A is used. | |
* | |
* @param itemA An object or an array, which defines the merge | |
* @param itemB A matching object or array which will be merging in | |
* @returns object|array |
const ageRange = birthYear => { | |
// get age | |
let age = new Date().getFullYear() - birthYear | |
// range of ages | |
const range = [ | |
0, | |
4, | |
9, | |
14, |
/** | |
* A handy module pattern | |
*/ | |
const Module = (function () { | |
/* | |
** Private variables | |
*/ | |
let private = { | |
i: 0 |
Mostly taken from: https://gitlab.com/sebdeckers/express-history-api-fallback, without all the repo/package fluff.
let staticPath = '/path/to/dist'
app.use(express.static(staticPath))
app.use('/', ((...args) => (req, res, next) => {
if ((req.method === 'GET' || req.method === 'HEAD') && req.accepts('html')) {
(res.sendFile || res.sendfile).call(res, ...args, err => err && next())