Opengist Logo Gist@portalZINE

Explore

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

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
C

Coding

Recently created Least recently created Recently updated Least recently updated
portalzine

portalzine / Extract text between two tags (domDocument)

Last active 3 months ago Coding PHP Solutions domDocument
0 0 1
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

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 }
portalzine

portalzine / Getting the average of an array of numbers

Last active 3 months ago Coding Numbers Solutions
0 0 2
1 $average_of_myfoos = array_sum($myfoos) / count($myfoos);