A Tiny Scrap of JavaScript
Fifteen years ago, when "Web 2.0" was a thing, Ben Nolan's Behaviour.js enlightened me to the virtues of declarative programming. Developing for a web-browser really lends itself to this approach. Using "sheets" to target particular JavaScript code at selected DOM elements provides a way to separate, in a consistent way, the behaviorial aspects of a web-page. For a while I'd subscribed to his advice to use JQuery instead, and this was incredibly effective but always felt like I was cheating. Including JQuery in a web-page for a tiny bit of convenience was just heavy handed. Now, 15 years later, I've finally weened myself off of that crutch too. Below is a tiny scrap of JavaScript that leverages the native JavaScript Document.querySelectorAll() function...
function attachBehaviors(behaviors, context = document) {
Object.entries(behaviors).forEach(([selector, behavior], index) => {
if (typeof behavior === 'function') {
context.querySelectorAll(selector).forEach(elm => {
behavior.call(this, index, elm);
});
}
});
}
export {attachBehaviors};
With this function available, now pass a "sheet"...
attachBehaviors({
'a.externallink': function(idx, elm) {
elm.addEventListener('click', function(evt) {
evt.preventDefault();
window.open(evt.target.href);
});
},
'form#uploadForm': function(idx, elm) {
elm.addEventListener('submit', function(evt) {
evt.preventDefault();
processFiles();
});
}
});
m2e-egit for Eclipse
In case you have trouble installing the m2e-egit connector in Eclipse, check out this site - www.mail-archive.com/m2e-users@eclipse.org/msg05143.html
Basically they recommend installing the latest version of m2e-egit connector from https://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-egit/0.15.1/N/LATEST/
Upgrade QNAP ContainerStation Gitlab
I finally figured out how to upgrade a Gitlab Docker container in QNAP's Container Station on my TS-453 Pro. Based on this post on QNAP's forum I was able to upgrade Gitlab from 8.9.6-1 to 11.4.5...
Edit the docker-compose.yml file for Gitlab...
vi /share/CACHEDEV1_DATA/.qpkg/container-station/data/application/gitlab/docker-compose.yml
Change the version image version to 11.4.5...
image: sameersbn/gitlab:11.4.5
Restart Docker...
docker-compose stop docker-compose up -d
NOTE: Since I was upgrading from a version prior to 8.11.0 I also had to add the below gitlab environment parameters in the docker-compose.yml file...
GITLAB_SECRETS_SECRET_KEY_BASE GITLAB_SECRETS_OTP_KEY_BASE
An example docker-compose.yml file can be found here at https://github.com/sameersbn/docker-gitlab/blob/master/docker-compose.yml.












