#javascript (20)

Seite 1 von 2

„Nothing can kill jQuery“

Unglaublich, aber wahr: jQuery existiert noch und ist in der vorletzten Woche in Version 4.0 erschienen. In der aktuellen Ausgabe des Bytes-Newsletters („Your weekly dose of JS“) heißt es dazu – neben der obigen Überschrift – sehr passend:

It doesn’t matter how many fancy coding agents or next-gen frameworks you throw at it — the $ God remains eternal. And it just celebrated its 20th birthday in style last week by dropping jQuery 4.0 out of nowhere.

Bis 2016/17 war es ein elementarer Bestandteil eines jeden Frontend-Entwickler-Skillsets, jQuery in- und auswendig zu kennen, gar zu beherrschen. 2006 als Library gestartet, die die unterschiedlichen JavaScript-Browser-APIs unter einem vereinten Interface zusammenfassen sollte, wurde es dank seiner Einfachheit für die Umsetzung von DOM-Manipulationen und Ajax-Requests bis zum Höhepunkt 2019 von 80% der Top-1-Million-Websites genutzt, so Wikipedia.

Ich bin recht froh, dass ich jQuery seit Hypercode-Gründung in 2019 tatsächlich kein einziges Mal mehr im Berufskontext anfassen musste oder ihm begegnet bin. Dafür sind unsere Projekte Evan You sei Dank zu modern.

Wenn ihr jQuery in 2026 immer noch benutzt, macht ihr vermutlich etwas falsch. Schließlich gibt es mit Vanilla JavaScript, also dem standardisierten Umfang unserer liebsten Script-Sprache, eigentlich alles, was das Frontend’ler-Herz begehrt. Spätestens in Kombination mit dem umfangreichen Node- und npm-Ökosystem. Wenn ihr jQuery in 2026 aber immer noch benutzen müsst, dann – auch cool – habt ihr jetzt eine neue Version.

Speaking of Frontend-Entwickler*innen: Bei Hypercode suchen wir gerade alle Ausprägungen davon – Junior, Senior und Werkstudenten. Wenn ihr was braucht oder wen kennt, meldet euch gerne. Sagt mir, ich hab euch geschickt.

Thanos.js

Reduce the file size of your project down to 50%, by randomly deleting half of the files.

Dazu muss nicht nur eine Library sondern konsequenterweise gleich sechs installiert werden:

$ gem install power

$ gem install reality

$ gem install mind

$ gem install space

$ gem install time

$ gem install soul

(via Jens)

The Super Tiny Compiler

Jamie Kyle vermittelt das Funktionieren eines Compilers – im Quelltext eines Compilers. Tolle Idee.

This is an ultra-simplified example of all the major pieces of a modern compiler written in easy to read JavaScript.

Reading through the guided code will help you learn about how most compilers work from end to end.

Bookmarklet to get the number of your GitLab contributions in 2018

If you are working with GitLab and are interested in the number of contributions you’ve made this year, here’s a handy, little bookmarklet to calculate your contributions.

GitLab Contributions Bookmarklet

  • Drag the link above to your browser’s bookmark bar.
  • Go to https://gitlab.com/users/​[username]/activity
    (replace [username] with, well, your username and, if necessary, gitlab.com with your custom domain).
  • Hit the bookmarklet and – voilà – there’s the number of your contributions made in 2018! 🎉

Screenshot of GitLab contributions bookmarklet

Here’s the JavaScript, if you’re interested or want to run it in your console:

(function() {
	var rects = document.querySelectorAll('#activity .js-contrib-calendar rect.user-contrib-cell');
	var name = document.querySelectorAll('.user-info .cover-title')[0].textContent.replace(/(\r\n\t|\n|\r\t)/gm,'');
	var yearToCount = '2018';
	var counter = 0;
	rects.forEach((item) => {
		var text = item.getAttribute('data-original-title');
		var count = text.substr(0, text.indexOf(' ')); 

		if (text.indexOf(yearToCount) > -1 && count !== 'No') {
			counter += parseInt(count);
		}
	});
	alert(name + ' did ' + counter + ' contributions in ' + yearToCount + '.');
}())

OpenSC2K, SimCity 2000 build with JavaScript

In unserer beliebten Reihe der JavaScript-Nachbauten von Retro-Software folgt heute nach Winamp und MS Paint ein Spielklassiker, mit dem ich damals unendlich viel Zeit verbrachte: SimCity 2000, nachgebaut mit JavaScript, der HTML5 Canvas API1, SQLite und eingepackt mit Electron.

Update, 24.08.2018: Das Repo steht nicht mehr zur Verfügung → DMCA-Takedown-Notice.

  1. Die übrigens auch für den interaktiven Header dieses Blogs verwendet wird. []