Skip to content

Instantly share code, notes, and snippets.

View PorraphitChuasuk's full-sized avatar

Poraphit.c PorraphitChuasuk

View GitHub Profile
@PorraphitChuasuk
PorraphitChuasuk / shell.sh
Created July 21, 2021 04:33
Node minify json one line.
node -e 'console.log(JSON.stringify(JSON.parse(require("fs").readFileSync(0))))' < input.json > output.json
<?php
class WorkingDayCalculator {
/**
* @param int $workingDay
* Number of days to calculate
* @param string $startDate
* Start counting date
* @param array|string[] $holidays [optional]
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD+c+8eHYYyDhnEQ5pEcza2THRIAb+2Zlbdv03DVmt7bFHzAjsA9qlbBo6pZX2nmDI74dIyfXX/xZjUQBWBKKLlLZPajVlAQYN0faFiUCLnY1edvUB3KZrNY4HK/+Rl3zJbkOhRrp3i5zE5M1yi4IIZNSHIpMIyDz71hyrD5mHo+tSF+QWsZNWur/4F9/c24NMunzc6IRMHKx8BW51Ip6ULwqNJnegTDgDaFGj1cmclvxUPmi0R7ihrnxV120240ypZrvQdZojt8PX/cKdYug3m737y8TSldkN6GO9o0V2KYisoLDdZv03g56cAWwkVxrhyCQqdQje0XXP4CS6QO73pLc/88PSxbLKps3v76SICtlrODAlrGDLmQwGPwj3DJwkcTYOnbg4HHaV4pgqHp4rOsPlgqxDqdRwqeWRv67OEgmnH0yiYKDcLS7mKw8NK+lmpLL4V9oU+GEpwS6Xjos051vY43S44UzlMeIG8sNxJ6Jjv5NoV0zFSfSs+yV5Dqxs= poraphit@poraphit-Virtual-Machine
SET @entityid = 5; -- category's ID
-- Select varchar/string based category attribute values
SELECT ea.attribute_id, ea.attribute_code, eav.value AS 'value', 'varchar' AS 'type'
FROM catalog_category_entity e
JOIN catalog_category_entity_varchar eav ON e.entity_id = eav.entity_id
JOIN eav_attribute ea ON eav.attribute_id = ea.attribute_id
WHERE e.entity_id = @entityid
-- Select integer based category attribute values (includes boolean values)
UNION(
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChl8+uUaWQuZpjkb3aZyIQZGIhHZJ9htfqXCVWGawGqclaE2yj1hBMLbJ8NWiTIdeHkLa4waqlbhurTsz4LjWPH0hlupFnvhjPbrvlESLDEAflts6MmJJawMFy6375gZgrW/uJFCG2qlVm7n5G8XWVN80LwVxskyafIgOYce94MTTyeLHBpMOVIYMVSCb8G1CAIYEXL01t1mlLxxzud1Q54Nh9kZTVPdOIR9M5vs9nqmGL8wCsiL/TtfRBWxqtUNA6Uq6jaj2QZ+lJYHP7BqT+k2mxXd8piOEksQr1UHtuNXA4sNr2789mcFgtUq4E0aAVqLjsdP+PjobfgD+8hyKt [email protected]
@PorraphitChuasuk
PorraphitChuasuk / convBase.php
Created March 5, 2018 12:50 — forked from macik/convBase.php
Convert an arbitrarily large number from any base to any base.
<?php
/*
Convert an arbitrarily large number from any base to any base.
string convBase(string $numberInput, string $fromBaseInput, string $toBaseInput)
$numberInput number to convert as a string
$fromBaseInput base of the number to convert as a string
$toBaseInput base the number should be converted to as a string
examples for $fromBaseInput and $toBaseInput
@PorraphitChuasuk
PorraphitChuasuk / mage_get_select_count_sql_distinct.md
Created January 30, 2018 09:30 — forked from evgv/mage_get_select_count_sql_distinct.md
Magento. Rewrited getSelectCountSql() method, added DISTINCT form GROUP_BY param.
    /**
     * Get SQL for get record count
     * 
     * Rewrited for GROUP_BY
     * @return Varien_Db_Select
     */
    public function getSelectCountSql()
    {   
 $this-&gt;_renderFilters();
@PorraphitChuasuk
PorraphitChuasuk / composer.json
Created January 4, 2018 11:45 — forked from andyshinn/composer.json
Docker Compose PHP Composer Example
{
"require": {
"mfacenet/hello-world": "v1.*"
}
}