Skip to content

Instantly share code, notes, and snippets.

View codeorelse's full-sized avatar

codeorelse

View GitHub Profile
# Creatives that work with LemonPI
# To do
- backup gif? couldn't splash do this already? should we require it and mention it in the lemonpi-creative.json => nopes
- how should we indicate loading propositions failed? the creative will still call getPropositions(), and get an empty array. should there be some function a creative can call to check whether fetching propositions was successful? => the user should just check the respones value from getProposition() and getPropositions().
# Introduction
This document specifies what a (dynamic) HTML5 creative should look like in order to be used in LemonPI.

Creatives that work with LemonPI

To do

  • backup gif? couldn't splash do this already? should we require it and mention it in the lemonpi-creative.json => nopes
  • how should we indicate loading propositions failed? the creative will still call getPropositions(), and get an empty array. should there be some function a creative can call to check whether fetching propositions was successful? => the user should just check the respones value from getProposition() and getPropositions().

Introduction

This document specifies what a (dynamic) HTML5 creative should look like in order to be used in LemonPI.

NOTE: this is work in progress

The first version of the API will be available under /api/v0/.

Error handling

Requests that fail return the appropriate HTTP status codes, with JSON response body describing the error in more detail.

An example error object:

@codeorelse
codeorelse / download_image.js
Created March 3, 2016 07:44
Download image for Dynamic Video
function downloadAsset(assetUrl, renameTo, dataFolder)=> {
var defer = Promise.defer()
var download = new Download()
.get(assetUrl)
.rename(renameTo)
.dest(path.resolve(dataFolder)
download.run(function (err, files, stream) {
defer.resolve();
});
@codeorelse
codeorelse / scraper.0.2.24.min.js
Created March 6, 2016 20:12
Scraper Client JS
/*! bluemango-scraper - v0.2.24 - 2016-02-16 */
!function(a){"use strict";function b(){return window.location.origin||(window.location.origin=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")),window.location.href}function c(){return window.location.hash}function d(){return window.location.pathname}function e(){return window.location.origin}function f(a){var b=/^(?:[a-z]+:)?\/\//i;return b.test(a)}function g(b,c){var d=h(b.split("#")[0]),e=j.getOrigin()+j.getPathName(),f=[];return a.each(c,function(a,b){"number"==typeof a&&(a=b,b=c[a]);var e=d[a];e||(e=b),f.push(a+"="+e)}),e+"?"+f.join("&")}function h(a){for(var b,c={},d=a.slice(a.indexOf("?")+1).split("&"),e=0;e<d.length;e++)b=d[e].split("="),c[b[0]]=b[1];return c}var i={allowAllFieldNames:!1,debug:!1,fieldNames:["id","available","title","imageUrl","clickUrl","category","basket","description","priceNormal","priceDiscount","logoUrl","stickerText","custom1","custom2","custom3","custom4"]},j=function(b,c){
@codeorelse
codeorelse / structure.md
Last active October 19, 2016 18:32
LemonPI plain HTML structure

LemonPI plain HTML structure

1. Required files

Every creative should at least contain these files in the root directory:

index.html

Contains the structure of the creative. Inline CSS and JavaScript will be ignored.

Ad dimensions HEAD tag

The index.html must have a tag in the HEAD that specifies the creative's dimensions.

/**
* Adwords Uptime Robot Monitoring script
*
* Script that checks whether the websites that the Adword campaigns rely on are still live
* and respond fast enough, or if not, pause the related campaigns.
*
* Services used to determine uptime:
* - Uptime Robot
*
* @version 0.1.0
@codeorelse
codeorelse / breakWordsIntoTwoWords.js
Last active January 31, 2017 08:43
Break word instances to seperate words
var breakWordsIntoTwoWords = function(sentenceContainingWord, word) {
var regex = /hypotheek([^ ][-a-z]*)/gi;
while ((m = regex.exec(sentenceContainingWord)) !== null) {
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
var firstLetterCapital = word.substr(0,1).toUpperCase();
var searchForWord = m[0].substr(0,1) === firstLetterCapital ? firstLetterCapital + word.substr(1) : firstLetterCapital.toLowerCase() + word.substr(1);
@codeorelse
codeorelse / index.js
Last active February 17, 2017 13:31
Basic server Heroku
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hola Luis!');
});
app.listen(process.env.PORT || 3000, function () {
console.log('App listening on port 3000!');
})
window.configuration = {
id: 'xxxxxxx',
deepLink: 'http://www.opel.nl/apps/Configurator/KARL/Default.aspx#configurator/public/start?id=xxxxxx',
model: 'KARL',
color: 'Absolute Red (GG2)', // Name of the selected color
imageUrl: 'http://opel.pics/Picture.aspx?picture=BASEv01_GAZ_GROUNDSHADOW_TIRE14_BASEv01_GAZ-PAINTv01_GAZ-REARBUMPERv01_TAOHv01_JM4_RRAv01_OFF-T3N_A8D_GLASSv01_NAMEPLATESv01_NAMEPLATEv01_GAZ-WE1v01_OFF-T79v01_BTOv01_GAZ-D75v01_TTQ_V22v01&folder=0H%2048&ccl=GAZ&trm=TAOH&v=2&gmmy=2018A&wheel=skip&format=png&w=380&s=front', // First image of the car in the configuration
};