Skip to content

Instantly share code, notes, and snippets.

View bluvertigo's full-sized avatar

Andrea Gentili bluvertigo

View GitHub Profile
<?php
public function create()
{
$productCollection = $this->_getProductCollection();
$pages = $productCollection->getLastPageNumber();
$pageNumber = 1;
do {
$productCollection->setCurPage($pageNumber);
$productCollection->load();
foreach ($productCollection as $product) {
@bluvertigo
bluvertigo / timelapse.sh
Created February 9, 2018 12:54
Script generate timelaps
#!/bin/sh
mkdir resized
mogrify -path resized/ -resize x1080 `find . -name '*.JPG'`
cd resized
cat *.JPG | ffmpeg -f image2pipe -r 5 -vcodec mjpeg -i - -vcodec libx264 -movflags faststart out.mp4
@bluvertigo
bluvertigo / convert_mov.sh
Last active March 23, 2018 09:08
Convertire file mov in mp4
#!/bin/bash
# uso ./convert_mov.sh NOME_FILE
filename=$1
ffmpeg -i $filename.mov -vcodec h264 -acodec aac -strict -2 $filename.mp4
# Alternativa
# ffmpeg -i data/video.mp4 -vcodec h264 -b:v 1000k -acodec mp2 data/output.mp4

docker-compose exec php /bin/bash

XDEBUG_CONFIG="idekey=phpstorm" PHP_IDE_CONFIG="serverName=docker" php -d xdebug.remote_enable=1 -d xdebug.remote_port=9000 -d xdebug.remote_host=10.0.0.136 -d xdebug.remote_mode=req -d xdebug.remote_connect_back=0 bin/magento app:config:import

@bluvertigo
bluvertigo / script.sh
Created January 12, 2018 10:56
Command for determining my public IP
curl ipinfo.io/ip
@bluvertigo
bluvertigo / observer.php
Created January 9, 2018 10:15
Check if product is new using observer
<?php
class Some_Module_Model_Observer{
protected $isNew = false;
public function beforeSave($observer) {
$product = $observer->getEvent()->getProduct();
if($product->isObjectNew()){
$this->isNew = true;
}
}
public function afterSave($observer) {
curl -s -w 'Test del tempo di risposta per :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null http://www.google.com
curl -s -w 'Test del tempo di risposta per :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null http://www.google.com

Come lanciare un test in locale:

docker-compose exec php /var/www/html/vendor/bin/phpunit -c /var/www/html/dev/tests/integration/phpunit.local.xml --testsuite NomeTest

Cancellare il db dell'integration_tests:

docker-compose exec mysql_integration mysql -u root -pmagento -e "drop database integration_tests; create database integration_tests;"

cat ~/.ssh/id_rsa.pub | xclip -sel clip