Skip to content

Instantly share code, notes, and snippets.

View phamngsinh's full-sized avatar

Pham Ng Sinh phamngsinh

View GitHub Profile
@phamngsinh
phamngsinh / gist:ba9d5e8da4e8d3b90894dc7f2a5ab333
Created July 4, 2022 03:05
Get Product URL for Specific Store in Magento 2
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Api\ProductRepositoryInterface;
class Data extends AbstractHelper
{
protected $productModel;
protected $productRepository;
@phamngsinh
phamngsinh / gist:494b8af95ca449da8009e332f87ce101
Created May 8, 2022 16:10
How to check if port is in use on Linux or Unix
sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo ss -tulpn | grep LISTEN
sudo lsof -i:22 ## see a specific port such as 22 ##
sudo nmap -sTU -O IP-address-Here
https://www.dannyenglander.com/blog/drupal-9-devops-recipe-for-setting-up-xdebug-3-with-lando-and-phpstorm/
https://docs.lando.dev/guides/lando-phpstorm.html#xdebug-3-x-php-7-3
@phamngsinh
phamngsinh / gist:90c8f8cde0cf26962c7170cab08bc565
Created March 29, 2022 15:17
Generate log with object manager for debugging
\Magento\Framework\App\ObjectManager::getInstance()
->get(\Psr\Log\LoggerInterface::class)->debug('your message')
PHPSTORM template
\Magento\Framework\App\ObjectManager::getInstance()
->get(\Psr\Log\LoggerInterface::class)->debug($END$)
@phamngsinh
phamngsinh / gist:a87d394dd8610c8c1b9e45aff64192b4
Last active March 22, 2022 08:57
location docker bitnami nginx config at container
nginx -t
/opt/bitnami/nginx/conf/nginx.conf
/opt/bitnami/nginx/conf/vhosts/lando.conf
@phamngsinh
phamngsinh / gist:31d6ab1c653db1c17482686aa0b73a7b
Created October 31, 2021 04:53
macOS 11 Dnsmasq MailHog Redis Nginx Multiple PHP Versions
Setup
Before starting you need xcode installed with the cli tools. Also, you will need VS Code installed with the code command in your system path.
xcode-select --install
And, homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
OpenSSL
Install OpenSSL.
https://bootstrap-vue.org/
@phamngsinh
phamngsinh / gist:9dd5688627a491f7899bf033689832cf
Created October 16, 2021 16:50
Logs location on Linux servers
Apache – /var/log/httpd/
IIS – C:\inetpub\wwwroot\
Node.js – /var/log/nodejs/
nginx – /var/log/nginx/
Passenger – /var/app/support/logs/
@phamngsinh
phamngsinh / gist:ecad4fb9efea4fe12b5c0465587c49af
Created October 16, 2021 16:08
Facebook chat embed website
<style type="text/css">
.smagic39-messages { position: fixed; bottom: 0; right: 0; z-index: 999999; }
.smagic39-messages-outer { position: relative; }
#hisella-minimize { background: #3b5998; font-size: 14px; color: #fff; padding: 3px 10px; position: absolute; top: -34px; left: -1px; border: 1px solid #E9EAED; cursor: pointer; }
@media screen and (max-width:768px){ #hisella-facebook { opacity:0; } .smagic39-messages { bottom: -300px; right: -135px; } }
</style>
<div id='fb-root'></div>
<script>
(function($) { $(document).ready(function(){ $( '#hisella-minimize' ).click( function() { if( $( '#hisella-facebook' ).css( 'opacity' ) == 0 ) { $( '#hisella-facebook' ).css( 'opacity', 1 ); $( '.smagic39-messages' ).animate( { right: '0' } ).animate( { bottom: '0' } ); } else { $( '.smagic39-messages' ).animate( { bottom: '-300px' } ).animate( { right: '-135px' }, 400, function(){ $( '#hisella-facebook' ).css( 'opacity', 0 ) } ); } } ) }); })(jQuery);
(function(d, s, id) {
@phamngsinh
phamngsinh / gist:1e4f58bf304bd61450b8ae1144678706
Created October 16, 2021 16:07
5 LOẠI KÍCH THƯỚC TỜ RƠI THÔNG DỤNG
TỜ RƠI A3: KÍCH THƯỚC 29,7CM X 43CM
TỜ RƠI A4: KÍCH THƯỚC 21CM X 29,7CM
TỜ RƠI A5: KÍCH THƯỚC 10,5CM X 14,8CM || 14,8CM X 21CM
TỜ RƠI NHỠ: KÍCH THƯỚC 10CM X 20CM