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 Coding

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

portalzine / Extract text between two tags (domDocument)

0 likes
0 forks
1 files
Last active 7 months ago
Coding PHP Solutions domDocument
1 $tag = "p";
2 $html ="I am here!";
3 $dom = new domDocument('1.0', 'utf-8');
4 $dom->loadHTML($html);
5 $dom->preserveWhiteSpace = false;
6
7 $findTag = $dom->getElementsByTagName($tag);
8
9 echo $findTag->item(0)->nodeValue;
portalzine's Avatar

portalzine / Randomly reorder a list

0 likes
0 forks
1 files
Last active 7 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 }
portalzine's Avatar

portalzine / Getting the average of an array of numbers

0 likes
0 forks
2 files
Last active 7 months ago
Coding Numbers Solutions
1 $average_of_myfoos = array_sum($myfoos) / count($myfoos);
Newer Older

Powered by Opengist ⋅ Load: 93ms⋅

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