Skip to content

Instantly share code, notes, and snippets.

@ceckoslab
ceckoslab / js-plotly-grafana-time-to-first-byte.js
Created December 26, 2022 21:07
JavaScript - Plotly - Grafana - Time To First Byte
var xValue = [];
var yValue = [];
var dataFound = true;
try {
var xValue = data.series[0].fields[0].values.buffer;
var yValue = data.series[0].fields[1].values.buffer;
}
catch (e) {
@ceckoslab
ceckoslab / layout-plotly-grafana-time-to-first-byte.json
Created December 26, 2022 21:04
Layout - Plotly - Grafana - Time To First Byte
{
"barmode": "stack",
"legend": {
"bgcolor": "#fff",
"orientation": "h"
},
"margin": {
"b": 30,
"l": 45,
"pad": 4,
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@ceckoslab
ceckoslab / basic-rum-beacon-transfer-cloudflare-edge-worker.js
Last active December 14, 2021 21:18
A concept of Cloud Flare edge worker that is used for transferring beacons to beacon catcher server.
var beaconCatcherAddress = "https://rum.revampix.com/beacon/catcher.php"
addEventListener('fetch', event => {
event.respondWith(handle(event, event.request))
})
async function asyncFetch(request) {
let response = fetch(request)
.then(
function() {},
@ceckoslab
ceckoslab / psi-automated-monitoring.js
Created May 21, 2019 21:46
Automated Page Speed Insights monitoring Google App Script snippet
var scriptProperties = PropertiesService.getScriptProperties();
var pageSpeedApiKey = '';
var pageSpeedMonitorUrls = [
'https://www.example-url-here.de'
];
function createHeadingIfNoteExist() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getSheetByName('Sheet1');
@ceckoslab
ceckoslab / sync-catalog-cms-salesrules.php
Created December 24, 2017 14:11
Script that syncs Magento catalog, cms blocks and pages, sales rules
<?php
$mysqlCommandPath = 'mysql';
$mysqldumptCommandPath = 'mysqldump';
$remoteDbUnsername = '';
$remoteDbPassword = '';
$remotePort = '';
$remotHost = '';
$remoteDb = '';
@ceckoslab
ceckoslab / ttfp-and-network-type-and-first-network-hop-to-GA.js
Created May 14, 2017 18:19
This snippet sends Time to First Paint, Connection type and Speed to first network hop if they are supported by browser JS API. The script sends the data to GA custom dimension that is set with Session scope. It also tries to guess if the customer visits the website for first time by setting a cookie for 8 hours. In specific case the cookie life…
(function() {
function createCheckCacheCookie() {
var expireHours = 8;
var date = new Date();
date.setTime(date.getTime() + (expireHours*60*60*1000));
document.cookie = "assumedColdCache=true" + "; expires=" + date.toUTCString() + "; path=/";
}
function cacheCookieExists()
{
@ceckoslab
ceckoslab / dump-subset-of-magento-orders-and-customer-data.php
Created January 9, 2017 22:24
Proof of concept of script that does mysql dump of subset of Magento orders + related sales tables and customer's data of customer that did the orders. The script also attempts to import the data in local database. Currently the script gets last 1000 orders and customers data of customers that created the orders. Data anonymization is not implem…
<?php
$mysqlCommandPath = 'to be filled';
$mysqldumptCommandPath = 'to be filled';
$remoteDbUnsername = 'to be filled';
$remoteDbPassword = 'to be filled';
$remotePort = 'to be filled';
$remotHost = 'to be filled';
$remoteDb = 'to be filled';
@ceckoslab
ceckoslab / dataflow profile coupon import action xml.xml
Created December 6, 2015 18:54
dataflow profile coupon import action xml
<action type="dataflow/convert_adapter_io" method="load">
<var name="type">file</var>
<var name="path">var/import</var>
<var name="filename"><![CDATA[coupons_test.csv]]></var>
<var name="format"><![CDATA[csv]]></var>
</action>
<action type="dataflow/convert_parser_csv" method="parse">
<var name="delimiter"><![CDATA[,]]></var>
<var name="enclose"><![CDATA["]]></var>
name description is_active website_ids customer_group_ids coupon_code sku uses_per_coupon uses_per_customer from_date to_date discount_amount simple_action
Test Name Test Description 1 0 all test-code_all_groups wbk002c 1000 10 4-12-2015 1.33 by_fixed
Test Name Test Description 1 0 0,1,2 test-code_specific_groups wbk002c 1000 10 4-12-2015 1.33 by_fixed
Test Name Test Description 1 all 0 test-code_all_websites wbk002c 1000 10 4-12-2015 1.33 by_fixed
Test Name Test Description 1 all 0 test-code_all_websites_multiple_skus wbk002c,shw003 1000 10 4-12-2015 1.33 by_fixed