Skip to content

Instantly share code, notes, and snippets.

function changeImage() {
player.requestAsset({
attribute: 'image',
type: 'image'
}, function(data) {
// Ensure the property this relies on actually exists
if (data.representations) {
// First representation is the original
var image = data.representations[0];
// Update link image since new render is not triggered
@ThrivingKings
ThrivingKings / Retinaizer.css
Created August 1, 2013 20:21
Use JavaScript and CSS to quickly upgrade your images for Retina displays (Retinaizer)
div {
background: url('/img/background.jpg');
}
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
div {
background-image: url('/img/[email protected]');
background-size: 100px 100px;
// This should match the dimensions of the original resolution image
@ThrivingKings
ThrivingKings / Sess-io.js
Last active December 17, 2015 02:09
Using localStorage, Sess-io will check against a stored expiration stamp and force the user to log-out once the session has expired
// Sess-io by @ThrivingKings
// http://thrivingkings.com/read/Sess-iojs-handles-session-expiration-in-pure-JavaScript
// Date fix for good ole IE8
if (!Date.now) {
Date.now = function() {
return new Date().valueOf();
}
}