All New

user:thomas gists created by user

title:mygist gists with given title

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

Login


All New Login

All gists matching topic Javascript

Recently created
Least recently created
Recently updated
Least recently updated
portalzine's Avatar

portalzine / Uint8Array-Objekte from Text with Icons

0 likes
0 forks
1 files
Last active 1 month ago
Javascript
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's Avatar

portalzine / Randomly reorder a list

0 likes
0 forks
1 files
Last active 9 months ago
Coding Javascript Solutions
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 }
Newer Older

Powered by Opengist ⋅ Load: 80ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文
⋅ Data Privacy