Skip to content

Instantly share code, notes, and snippets.

View clickhouse-get-tables-size.sql
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
WHERE active
GROUP BY table
ceckoslab / basic-rum-beacon-transfer-cloudflare-edge-worker.js
Last active Dec 16, 2020
A concept of Cloud Flare edge worker that is used for transferring beacons to beacon catcher server.
View basic-rum-beacon-transfer-cloudflare-edge-worker.js
var beaconCatcherAddress = ""
addEventListener('fetch', event => {
event.respondWith(handle(event, event.request))
async function asyncFetch(request) {
let response = fetch(request)
function() {},
ceckoslab / psi-automated-monitoring.js
Created May 21, 2019
Automated Page Speed Insights monitoring Google App Script snippet
View psi-automated-monitoring.js
var scriptProperties = PropertiesService.getScriptProperties();
var pageSpeedApiKey = '';
var pageSpeedMonitorUrls = [
function createHeadingIfNoteExist() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getSheetByName('Sheet1');
ceckoslab / sync-catalog-cms-salesrules.php
Created Dec 24, 2017
Script that syncs Magento catalog, cms blocks and pages, sales rules
View sync-catalog-cms-salesrules.php
$mysqlCommandPath = 'mysql';
$mysqldumptCommandPath = 'mysqldump';
$remoteDbUnsername = '';
$remoteDbPassword = '';
$remotePort = '';
$remotHost = '';
$remoteDb = '';
ceckoslab / ttfp-and-network-type-and-first-network-hop-to-GA.js
Created May 14, 2017
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…
View ttfp-and-network-type-and-first-network-hop-to-GA.js
(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 / dump-subset-of-magento-orders-and-customer-data.php
Created Jan 9, 2017
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…
View dump-subset-of-magento-orders-and-customer-data.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 / dataflow profile coupon import action xml.xml
Created Dec 6, 2015
dataflow profile coupon import action xml
View dataflow profile coupon import action xml.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 type="dataflow/convert_parser_csv" method="parse">
<var name="delimiter"><![CDATA[,]]></var>
<var name="enclose"><![CDATA["]]></var>
View coupon import csv example.csv
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
ceckoslab / order ids helper
Created Jul 28, 2014
Example snippet of helper class, that checks if the order items are owned by the current customer
View order ids helper
* @author Tsvetan Stoychev <>
* @website
class MyCompany_MyModule_Helper_Data extends Mage_Core_Helper_Abstract
/** @var Varien_Db_Adapter_Interface $readConnection */
ceckoslab / example sql query
Created Jul 28, 2014
Check if order items are owned by the current customer
View example sql query
SELECT `oi`.`item_id`, `o`.`customer_id` FROM `sales_flat_order_item` AS `oi`
RIGHT JOIN `sales_flat_order` AS `o` ON oi.order_id = o.entity_id and o.customer_id != 8 WHERE (oi.item_id IN(2, 3))