Skip to content

Instantly share code, notes, and snippets.

View mattkelley's full-sized avatar

Matt mattkelley

  • Austin, TX
View GitHub Profile
@mattkelley
mattkelley / grunt-modify-a-task.js
Created October 20, 2015 16:21
modify grunt tasks inside registerTask
// Reconfigure tasks
Array.prototype.map.call([
// Unit tests should run in the background
['karma.unit.background', true],
// Unit tests should run on every JS change
['karma.unit.singleRun', false]
], function(args) {
return grunt.config.set(args[0], args[1])
});
@mattkelley
mattkelley / card-animation.js
Last active October 1, 2015 17:03
GoPro theme configs
// Position config for GoPro Cards
"position": {
"x": '-50%',
"y": '6%',
},
// Animation config for Cards
"animate": {
"duration": {
"start": .3,
"end": .3
@mattkelley
mattkelley / surfing-pig-implementation.html
Last active September 28, 2015 15:39
Invodo & GoPro - Shoppable: Surfing Pig
<!-- <head> -->
<!-- Include GoPro Shoppable Video styles in the document HEAD -->
<link rel="stylesheet" href="//ixd.invodo.com/ivp-experiences/gopro/theme.min.css">
<!-- </head> -->
<!-- <body> -->
<!-- The experience requires a DOM element -->
<div id="gopro-ivp-widget"></div>
<!-- Include Invodo.js on the page -->
@mattkelley
mattkelley / element_interface.js
Created August 27, 2015 19:21
element_interface.js
// Import lo-dash lang category
import lang from 'lodash/lang';
// Import lo-dash template string function
import stringTemplate from 'lodash/string/template';
// import assign from 'lodash/object/assign';
import forEach from 'lodash/collection/foreach';
// Loop through configs stored and return the matching config (value) element (key)
function reverseMapFind(id, map) {
<!-- The experience requires a DOM element -->
<div id="gopro-ivp-example-widget"></div>
<!-- Include Shoppable Video styles on the page -->
<link rel="stylesheet" href="//ixd.invodo.com/ivp/2.1.0/ivp.min.css">
<!-- Include Invodo.js on the page -->
<script src="//e.invodo.com/4.0/s/ixd.invodo.com.js"></script>
<!-- Include Shoppable Video library on the page -->
<script src="//ixd.invodo.com/ivp/2.1.0/ivp.min.js"></script>
@mattkelley
mattkelley / formatTime.js
Created August 20, 2015 15:32
format time nicely
/**
* Utility for formating seconds into pretty time formats
* @OUTPUT as follows: 0:01, 1:01, 10:01, 1:10:01
**/
function formatTime(seconds) {
// video.duration returns NaN before loadedmetadata fires
var seconds = isNaN(seconds) ? 0 : seconds.toFixed();
var h = parseInt(seconds / 3600) % 24;
var m = parseInt(seconds / 60) % 60;
var s = seconds % 60;
// Override Product IDs here
// - these variables are hardcoded in the ivp experience, and are sent as parameters to the ___addToCart function
// - please redefine the product IDs here if they have changed
KERASTASE_BAIN_ELIXIR_ULTIME_PID = 3474630478244;
KERASTASE_BAIN_RICHE_PID = 3474630677241;
KERASTASE_ELIXIR_ULTIME_PID = 3474630346826;
KERASTASE_IMPERIAL_PID = 3474630476844;
KERASTASE_MASQUE_PID = 3474630477056;
KERASTASE_MORINGA_PID = 3474630476912;
@mattkelley
mattkelley / range.js
Created July 23, 2015 19:47
range slider module
var on = function(items, scope) {
items.forEach(function(item) {
return item.e.map(function(e) {
item.context.addEventListener(e,item.fn,false)
})
})
}
var off = function(items) {
@mattkelley
mattkelley / animation.js
Last active August 29, 2015 14:23
new animate config?
"animate": {
"show": [{
"duration": 1,
"tween": {}
}],
"hide": [{
"duration": 1,
"tween": {}
}]
}