hexagons and grids

Date posted: December 11, 2017

Check this….hexagons & grids

trust game

Date posted: September 13, 2017

check this game

Diving into ML

Date posted: August 2, 2017

tensorflow-tutorial

blur-detection-javascript
machine-learning-in-js
Tensorflow for Poets
kadenze-creative-applications-of-deep-learning-with-tensorflow
Tensorflow tutorial

this in javascript

https://medium.com/@alexandereardon/rethinking-drag-and-drop-d9f5770b4e6b

Compile angularjs code inside IE conditional tags

Date posted: January 14, 2016

I had a problem with Angularjs expressions inside IE conditional tags. The expressions were not compiled because Angular didn’t recognise them as Angular code but as comments.
The code looked almost like this:
<!--[if gte mso 9]>
<v:rect href="{{ expression }}" xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:435px;height:210px;"> <v:fill type="tile" src="{{ expression }}" color="#ebbb7b"/> <v:textbox inset="0,0,0,0"><![endif]-->

A simple solution is to generate the complete IE condition as a string in the controller and bind the sting to the front end using $sce with the $sce.trustAsHtml method.

$scope.trusted_html_text = function(t) { return $sce.trustAsHtml(t); };

$scope.outlook_background_660 = '<!--[if gte mso 9]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:660px;height:210px;"><v:fill type="tile" src="'+$scope.selected_hero_image_name+'" color="#ebbb7b"/><v:textbox inset="0,0,0,0"><![endif]--><!--del-->';

<div ng-bind-html="trusted_html_text(outlook_background_660)"></div>
where "outlook_background_660" is the conditional IE string

Uploading excel files into the browser

Date posted: October 26, 2015

My latest project at trivago: I HAD TO REMOVE THE LINK FOR SAFETY REASONS

The goal of this tool is to upload excel files to the server. After the excel is uploaded I create a table in the database. And fill the table with the data of the excel file.

The format of the excel file should be as followed:

Column 1. destination
Column 2. path id

In the mysql I create an extra column: default image.

Further background info:

Based on the “Path ID” I create a image filename. f.e. Amsterdam has path id: 46814 by default the image filename will be 46814_v1.jpg

With the results of the columns of the data inside the database I wil check if the images based on the default filename are available on the trivago server.

If they are available they will show up in the tool. I also check if there are more images (“versions”) available. They show up on the end of each row.

Users can change the default images by clicking them.

Once the user has chosen which version of the image he wants to use. And is ready editing. He can download the excel.

To make all this magic happen I use the following libraries:
http://johnculviner.com/jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/

https://github.com/danialfarid/ng-file-upload

Working with AngularJS – Rows and Columns

Date posted: June 24, 2015

Good examples that need some extra attention you can find here. I have to learn how this is working: jsFiddle

Adding JSzip to the project

Date posted: May 5, 2015

I have been working on a project were I need to download html and images from a website combined in one zip file. I found out about: JSzip. This Library does the job. The first problem: Multiple XMLHttpRequest for downloading the images. Al the time I only received the response result after from the last XMLHttpRequest.

I wrote a recurring function to solve this problem:

here is the complete script:


var aImagesSrcs = [],
iCounter = 0,
zip = new JSZip(),
imageFolder = zip.folder("images"),
newsletterName = 'newsletter.html';

function grabImages(){
if (iCounter < aImagesSrcs.length){ try{ var filename = aImagesSrcs[iCounter].replace(/^.*[\\\/]/, ''); console.log(filename); var xhr = new XMLHttpRequest(); xhr.open('GET', aImagesSrcs[iCounter], true); xhr.responseType = "arraybuffer"; xhr.onreadystatechange = function(evt) { if (xhr.readyState === 4) { if (xhr.status === 200) { imageFolder.file(filename, xhr.response); iCounter++; grabImages(); } } }; xhr.send(); } catch(e){ alert('Issue with browser.') } } if(iCounter == aImagesSrcs.length){ var content = zip.generate({type:"blob"}); saveAs(content, "newsletter.zip"); console.log("AND IT IS SAVED, YOU DID IT AGAIN!!"); } } function findAndReplaceSrcImages(sourceHTML){ var str = sourceHTML for(var i = 0; i< aImagesSrcs.length; i++){ var filename = aImagesSrcs[i].replace(/^.*[\\\/]/, ''); str = str.replace(aImagesSrcs[i], "images/"+ filename); } return str; } //src : http://jsfiddle.net/TzVd3/2/ function grabHtml(elId) { var str ='';
var elHtml = str + findAndReplaceSrcImages(document.getElementById(elId).innerHTML);
var body = '';
var n = elHtml.search("

") + "

".length;
var output = [elHtml.slice(0, n), body, elHtml.slice(n)].join('') + "";
zip.file(newsletterName, output);
}

$( document ).ready(function() {
//if the page is loaded first grab all images sources
aImagesSrcs = $('#main').children('img').map(function(){
return $(this).attr('src');
}).get();

$("#download_btn").click( function(){
grabHtml("main");
grabImages();
});
});

Prototyping download zip

Working from Palma de Mallorca

Date posted: April 16, 2015

Since I am a employee of trivago I have the privileges of working at our Mallorca office. We own a house on the island as big as a mansion. I am sharing this house at the moment with 6 colleagues. There is room for 12 persons. Here are some pics:

20150412_202646

20150412_202740

The house is beautiful, the island is beautiful, the people are beautiful but in the end I am here to work.

Actually I work on a really cool project: Generate responsive newsletters based on feeds. – After you have set up the newsletter you can downloading it by pressing the download button and use it for email campaigns.

concept : http://trv.to/design/newsletter/

requirements : MySQL database, Bootstrap, AngularJS

Started using Github

Date posted: March 11, 2015

I have started to upload files to github. If you think you can use anything I put in there. Be free to use it.

Quote at talk of Rüdiger Nehberg

Date posted: March 10, 2015

He who fights, can lose. He who doesn’t fight, has already lost.
— Bertolt Brecht