Skip to content

Instantly share code, notes, and snippets.

View vdubyna's full-sized avatar

Volodymyr Dubyna vdubyna

View GitHub Profile
@vdubyna
vdubyna / package.json
Last active December 28, 2015 13:09
Create magento package based on simple json object
{
"file_name": "Speroteck_Tabmenu",
"name": "Speroteck_Tabmenu",
"channel": "community",
"version_ids": ["2"],
"summary": "sdfsdfds",
"description": "dsfsdfdsfdsf",
"license": "OSC v3.0",
"license_uri": "",
"version": "0.1.1",
@vdubyna
vdubyna / magento-check-app.php
Created February 5, 2014 19:20
Load magento app and check some code
<?php
require_once 'app/Mage.php';
Mage::app('admin');
Mage::register('isSecureArea', 1);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
select count(*), HOUR(lu.visit_time) from log_url_info as ui JOIN log_url as lu on lu.url_id=ui.url_id JOIN log_visitor_info as vi on lu.visitor_id=vi.visitor_id where date(lu.visit_time) = '2014-03-19' GROUP BY HOUR(lu.visit_time);
select count(*) as c, ui.url from log_url_info as ui JOIN log_url as lu on lu.url_id=ui.url_id JOIN log_visitor_info as vi on lu.visitor_id=vi.visitor_id where date(lu.visit_time) = '2014-03-19' GROUP BY ui.url having c > 100;
@vdubyna
vdubyna / count_bots_by_agent.sql
Last active August 11, 2016 08:58
Count bots by user agent
select count(*) as c, vi.http_user_agent from log_url_info as ui JOIN log_url as lu on lu.url_id=ui.url_id JOIN log_visitor_info as vi on lu.visitor_id=vi.visitor_id where date(lu.visit_time) = '2014-03-19' and vi.http_user_agent like('%bot%') GROUP BY vi.http_user_agent ;
@vdubyna
vdubyna / install-0.1.0.php
Created July 3, 2014 12:09
Add website and stores
<?php
/* @var $this Lyonscg_Lasenza_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
// Canadian website
$rootCategory = Mage::getModel('catalog/category')->getCollection()
->addFieldToFilter('level', 1)->getFirstItem();
/** @var $canadianWebsite Mage_Core_Model_Website */
<?xml version='1.0' encoding="UTF-8"?>
<ruleset name="Magento PHPMD rule set" xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Magento Code Check Rules</description>
<!-- Code Size Rules -->
<!-- Code Complexity limitation -->
@vdubyna
vdubyna / verify.php
Created August 21, 2014 23:26
Verify eml DKIM
<?php
function get_middle($source, $beginning, $ending, $init_pos) {
$beginning_pos = strpos($source, $beginning, $init_pos);
$middle_pos = $beginning_pos + strlen($beginning);
$ending_pos = strpos($source, $ending, $beginning_pos + 1);
$middle = substr($source, $middle_pos, $ending_pos - $middle_pos);
return $middle;
}
Array
(
[Adv Master <[email protected]] => Array
(
[0] => Array
(
[0] => Adv Master <[email protected]
[1] => 023de639896d32d55391dc9a15db1aba.eml
[2] => signature ok
)
SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "oneida"
ORDER BY (data_length + index_length) DESC;