Skip to content

Instantly share code, notes, and snippets.

View Code-Case's full-sized avatar
🏠
Working from home

ColdCase Code-Case

🏠
Working from home
View GitHub Profile
@Code-Case
Code-Case / gist:690fc6aa8340f3260bbd10652b4c5c54
Created July 12, 2016 21:43
Google Analytics: HTML5 Video Tracking
document.addEventListener('DOMContentLoaded', init, false)
var videoId = document.getElementById('video')
//var videoTitle = videoId.getAttribute('data-description')
var videoTitle = '宝宝身边有怪物'
function init () {
videoId.addEventListener('ended', videoEnd, false)
videoId.addEventListener('timeupdate', videoTimeUpdate, false)
videoId.addEventListener('play', videoPlay, false)
@Code-Case
Code-Case / index.html
Created April 1, 2019 12:14 — forked from martinfilliau/index.html
Example of widget using the JSONP feed from the new status.ox website. Status is refreshed every 60 seconds.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Status - University of Oxford</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<style type="text/css">
.status_code_0 {background-color:#039b0b;}
.status_code_1 {background-color: #b94a48;}
.status_code_2 {background-color: #f89406;}
li {padding:0.5em; margin:0.5em; list-style:none; width:20em; font-size:1.3em;}
@Code-Case
Code-Case / xmlToJson.js
Created May 23, 2019 10:57 — forked from chinchang/xmlToJson.js
Function to convert XML to JSON
// Changes XML to JSON
// Modified version from here: http://davidwalsh.name/convert-xml-json
function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType == 1) { // element
// do attributes
if (xml.attributes.length > 0) {