Skip to content

Instantly share code, notes, and snippets.

View lukashavrlant's full-sized avatar
🐦
It's time to make a tea

Lukáš Havrlant lukashavrlant

🐦
It's time to make a tea
View GitHub Profile
var deep = require('json-diff')
var oldConfig = require(process.argv[2]);
var newConfig = require(process.argv[3]).localConfigurationKeys;
var x = deep.diffString(oldConfig, newConfig);
console.log(x);
{"columnHeaders":[{"name":"date","columnType":"DIMENSION","dataType":"DATE"},{"name":"siteName","columnType":"DIMENSION","dataType":"STRING"},{"name":"impression","columnType":"METRIC","dataType":"NUMBER"},{"name":"click","columnType":"METRIC","dataType":"NUMBER"},{"name":"fullViewRate","columnType":"METRIC","dataType":"RATIO"}],"query":{"dimensions":"date,siteName","end-date":"2016-03-29","filters":"demandAdServerCustomerId==255077c1-6a85-4015-f847-6701892db46c,inventoryAdServerCustomerId==255077c1-6a85-4015-f847-6701892db46c","metrics":"impression,click,fullViewRate","output":"json","start-date":"2015-01-01","timeZone":"Europe/Berlin"},"rows":[["2015-06-04","Matematika.cz",6,1,16.666666666666664],["2015-06-11","Matematika.cz",0,0,0],["2015-06-12","Matematika.cz",0,7,0],["2015-06-15","Matematika.cz",0,2,0],["2015-06-26","Matematika.cz",0,0,0],["2015-06-29","Matematika.cz",0,0,0],["2015-06-30","Matematika.cz",0,0,0],["2015-07-07","CPlusPlus",1,0,0],["2015-07-09","Matematika.cz",0,0,0],["2015-07-15","Matematik
{
"queryType": "groupBy",
"dataSource": {
"type": "query",
"query": {
"queryType": "groupBy",
"dataSource": "sdgadserver-videoimpression",
"granularity": "all",
"dimensions": [
"campaignId",
{
"id": "0123456789ABCDEF0123456789ABCDEF",
"at": 2,
"tmax": 120,
"imp": [
{
"id": "1",
"video": {
"mimes": [
"video/x-flv",
var _ = require("lodash");
var n = 100000000;
var sum;
var testArray = _.times(n);
var testArrayForMap = _.times(n / 5);
console.time("for loop");
sum = 0;
for (var i = testArray.length - 1; i >= 0; i--) {
@lukashavrlant
lukashavrlant / helpers.js
Last active September 11, 2015 05:41
šablona.excel
<worksheet
xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<dimension ref="A1"/>
<sheetViews>
<sheetView workbookViewId="0"/>
</sheetViews>
<sheetFormatPr defaultRowHeight="13.5"/>
<cols>
<col min="2" max="{{plusOne columnHeaders.length}}" width="18" />
function createAdSlotEventDataWithPath(commandData) {
var eventData = {
id: commandData.id,
adSlot: commandData.adSlot
};
eventData.path = getNodePath.call(this);
return eventData;
}
PortfolioNode.prototype.handleRemoveVideoAdSlotCommand = function (command) {
var _ = require("lodash");
var request = require("request");
var parseString = require('xml2js').parseString;
var urls = [
"http://video-adserver.ibillboard.com/getAd?tagid=9e981d28-98f2-4b93-e607-b0e3bd163d8d&type=preRoll",
"http://video-adserver.ibillboard.com/getAd?tagid=04cf2685-0825-4fa2-e693-62b6a2786290&type=midRoll",
"http://video-adserver.ibillboard.com/getAd?tagid=2b019b78-0da2-43de-fbbf-aafe4f2084ff&type=preRoll",
"http://video-adserver.ibillboard.com/getAd?tagid=da299470-e2c7-4455-a23c-dfe9cb1d52f2&type=overlay",
"http://video-adserver.ibillboard.com/getAd?tagid=b389bccd-d60b-40e8-858d-9c385f09e06b&type=postRoll",
{
"type": "index",
"spec": {
"dataSchema": {
"dataSource": "recovery1",
"parser": {
"type": "map",
"parseSpec": {
"format": "json",
"timestampSpec": {
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<dimension ref="A1" />
<sheetViews>
<sheetView tabSelected="1" workbookViewId="0">
<selection activeCell="D10" sqref="D10" />
</sheetView>
</sheetViews>
<sheetFormatPr defaultRowHeight="15" />
<cols>
<col min="2" max="2" width="19.42578125" customWidth="1" />