Skip to content

Instantly share code, notes, and snippets.

View Deele's full-sized avatar

Nils Deele

View GitHub Profile
@Deele
Deele / sse.html
Last active July 1, 2023 04:16
Server-Sent Events example, Javascript client-side, PHP server-side
<html>
<body>
<div id="result"></div>
<script>
if (typeof(EventSource) !== 'undefined') {
console.info('Starting connection...');
var source = new EventSource('/stream.php');
source.addEventListener('open', function(e) {
console.info('Connection was opened.');
}, false);
@Deele
Deele / baseHtml.js
Created January 7, 2015 22:24
Port of Yii2 BaseHtml class that provides a set of static methods for generating commonly used HTML tags
/**
* Returns whether given variable is undefined
*
* @author Nils Lindentals <nils@dfworks.lv>
* @license GNU GPL v2.0
*
* @param variable
* @returns {boolean}
*/
function isUndefined(variable) {