Skip to content

Instantly share code, notes, and snippets.

There are four classes that control the flip

.front-flip-sc - only used for keyframe animations
.back-flip-sc - only used for keyframe animations
.front-sc - styling for the front container
.back-sc - styling for the back container

The click handlers are appended on .cta-sc and .send-sc, but those are (should be?) design agnostic. They are only there for the script.

@daniellizik-sc
daniellizik-sc / bookmarklet
Created June 7, 2016 15:16
osr force show, supply a guid and then render any available osr template on any site
javascript:"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();!function(){var e=function(){var e={get:function(e){return new Promise(function(t,n){var i=new XMLHttpRequest;i.onreadystatechange=function(){var e=void 0;if(4===i.readyState&&200===i.status&&i.responseText)try{e=JSON.parse(i.responseText)}catch(n){e=i.responseText}finally{t(e)}},i.open("GET",e),i.send()})}},t={osr:function(t){return e.get(t)},sdk:function(t){return e.get(t)},template:function(t){return e.get(t).then(function(e){return Object.keys(e).reduce(function(t,n){return t[n]=decodeURIComponent(e[n]),t},{})})}},n=function(e){var t=document.createElement(e.el||"div"),n=e.attrs||{};for(var i in n)t[i]=n[i];return{el:t,a
@daniellizik-sc
daniellizik-sc / basket-items.spec.js
Created June 8, 2016 17:41
__scd.b.i spec, check for malformed item properties
($specs => {
'use strict';
console.group('%c__scd.b.i spec, check for malformed item properties', 'font-weight:900;font-size:1.4em')
$specs().forEach(t => {
console.log(`%c${t.msg}`, 'color:grey;font-weight:900');
console.log(`%c${t.res === true ? '[PASS]' : '[FAIL]'} actual: ${t.actual}`, `color:${t.res === true ? 'blue' : 'red'}`);
});
console.groupEnd();
@daniellizik-sc
daniellizik-sc / save-page.bookmarklet.js
Created June 15, 2016 19:46
Save a static html page with relative resource links converted
javascript:"use strict";!function(t,e,n){var o=function(t){if(!("undefined"==typeof t||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var e=t.document,n=function(){return t.URL||t.webkitURL||t},o=e.createElementNS("http://www.w3.org/1999/xhtml","a"),r="download"in o,i=function(t){var e=new MouseEvent("click");t.dispatchEvent(e)},a=/constructor/i.test(t.HTMLElement),c=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},u="application/octet-stream",l=4e4,d=function(t){var e=function(){"string"==typeof t?n().revokeObjectURL(t):t.remove()};setTimeout(e,l)},f=function(t,e,n){e=[].concat(e);for(var o=e.length;o--;){var r=t["on"+e[o]];if("function"==typeof r)try{r.c$(t,n||t)}catch(i){c(i)}}},s=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t},p=function h(e,c,l){l||(e=s(e));var p,h=this,w=e.type,m=w===u,v=function(){f(h,"writestart progress write writeend".spli
@daniellizik-sc
daniellizik-sc / promoGen.es5.js
Created June 16, 2016 14:14
unique promo code generation
/**
* takes email and returns unique id, may need .reduce polyfill for < ie8
*
* @param {string} str - an email address (or any string) to convert to unqiue id
* @returns {string} unique identifier
*/
function promoGen(str) {
var data = str.split('').reduce(function (acc, s, i) {
var code = s.codePointAt();
!function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}var r=n(12),i=n(14),a=o(i),u=n(15),c=o(u),l=n(16),d=o(l),s=(0,c["default"])();(0,a["default"])(s,"script").forEach(function(e){return e.parentNode.removeChild(e)}),(0,a["default"])(s,"link").forEach(function(e){return(0,d["default"])(e,"href")}),(0,a["default"])(s,"img").forEach(function(e){return(0,d["default"])(e,"src")});var f="<!doctype HTML>"+s.outerHTML,p="data:text/html;charset=UTF-8;base64,",v=btoa(unescape(encodeURIComponent(f))),w="\n Enter number corresponding to desired option:\n\n 1. Download as html file\n 2. Download as encoded base64 text file\n 3. Open as base64 data url in new tab (must allow popups on this page)\n",m=prompt(w),h={1:function(e){return(0,r.saveAs)(new Blob([f],{type:"text/html;charset=utf-8"}),e
@daniellizik-sc
daniellizik-sc / config.json
Last active June 21, 2016 19:13
callway osr fconfig
{
"clientId": 1671,
"name": "Callaway Golf",
"enabled": true,
"groupProducts": false,
"productGroupField": null,
"initParameter": null,
"surpressOsrOnEmailClick": false,
"emailClickSurpressionDuration": 0,
"controlGroup": {
@daniellizik-sc
daniellizik-sc / timer.min.js
Created June 22, 2016 14:51
countdown timer script
!function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=r(17),a=n(i);new a["default"]({mode:"decrement",delay:1e3})},,,,,,,,,,,,,,,,,function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(18),o=n(u),c=r(19),s=n(c),l=r(21),d=n(l),f=(r(20),r(22),r(23)),m=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?{delay:1e3,mode:"decrement"}:arguments[0];i
@daniellizik-sc
daniellizik-sc / README.md
Last active June 22, 2016 17:03
legacy specs

###usage

$$specRunner('emb', 'osr'); // => or any number test you want to run, pass it as a string
$$specRunner.help(); // => get a list of available tests to run

###available tests

'basketItems'

var deepsearch_find_first = function(needle, haystack, parent) {
var iterable;
if (Object.prototype.toString.call(haystack) === '[object Array]') {
iterable = haystack;
} else if (Object.prototype.toString.call(haystack) === '[object Object]') {
iterable = Object.keys(haystack);
} else {
return;