Opengist Logo Gist@portalZINE

Explore

  • All gists
  • Topics
  • Users
Data Privacy
Give feedback on the new UI Powered by Opengist ⋅ 99ms

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Login
J

Javascript

Recently created Least recently created Recently updated Least recently updated
portalzine

portalzine / Uint8Array-Objekte from Text with Icons

Last active 3 months ago Javascript
0 0 1
1 function encodeTextWithIcons(text) {
2 // Split text by icon pattern {number}
3 const parts = text.split(/(\{\d+\})/g);
4
5 const byteArray = [];
6
7 for (const part of parts) {
8 if (part === '') continue;
9
10 // Check if it's an icon pattern
portalzine

portalzine / Randomly reorder a list

Last active 3 months ago Coding Javascript Solutions
0 0 1
1 var reorder = function(selector){
2 var ul = document.querySelector(selector);
3 for (var i = ul.children.length; i >= 0; i--) {
4 ul.appendChild(ul.children[Math.random() * i | 0]);
5 }
6
7 }