Skip to content

Instantly share code, notes, and snippets.

//try every way we can to get the object ref. The new SwfObject code uses 'object' even for Mozilla browsers... tricky
var elem=((navigator.userAgent.toLowerCase().indexOf('msie')>=0)?'OBJECT':'EMBED');
var objRef;
try{
objRef = document.getElementById(objID).parentNode.getElementsByTagName(elem)[0];
}catch(e){}
if(!objRef)
objRef = document.getElementById(objID);
@chrisdeely
chrisdeely / gist:5399729
Created April 16, 2013 21:19
Javascript snippet to read URL query string parameters
var urlParams = {};
//Parse URL parameters
(function () {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
@chrisdeely
chrisdeely / gist:5444563
Created April 23, 2013 15:29
Simple postMessage example
<html>
<head>
<title>PostMessage test</title>
</head>
<body>
<script type="text/javascript">
function postIt(type, message){
var eventData = {type: type, message:message};
parent.postMessage(eventData, '*'); //allow any domain to receive the message
@chrisdeely
chrisdeely / hlsFetcher.py
Last active November 13, 2018 17:12 — forked from anonymouss/hlsFetcher.py
download hls segments from Azure Media Services
#!/usr/bin/env python3
# Http Live Streaming -- fetcher/downloader
# A simple script to download ts segments/m3u8 files from given url, including variant streams from master m3u8
# require: python3
import sys
import os
import urllib.request
TEST_URL = 'https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8'