Skip to content

Instantly share code, notes, and snippets.

@vovayatsyuk
vovayatsyuk / README.md
Last active August 1, 2022 15:55
Export and Import product reviews in Magento 1

Export and Import product reviews in Magento 1

Based on script by "Magento Craftsman in Melbourne": https://blog.mdnsolutions.com/migrate-products-reviews-and-ratings-programmatically/

The steps below will export product reviews at "source" server and import the same reviews into magento at "destination" server.

  1. Connect to the "source" server. (If your server allows remote mysql connections you can do the steps 2-6 from local environment.)
@vovayatsyuk
vovayatsyuk / mysql.md
Last active April 12, 2019 13:42
Mysql snippets

Truncate all tables

mysql -u USER -pPASSWORD -Nse 'show tables' DATABASE | while read table; do mysql -u USER -pPASSWORD -e "SET FOREIGN_KEY_CHECKS = 0; truncate table $table" DATABASE; done

Export data

mysqldump -u USER -pPASSWORD --no-create-info DATABASE > mydb.sql
@vovayatsyuk
vovayatsyuk / gist:a21dde8783d9784a0ad69fd879da5b67
Last active May 18, 2020 07:22
Generate Magento2 Changelog
git diff 2.1.7..2.1.8 -- . \
':!*/Test/*' \
':!/dev/*' \
':!/setup/*' \
':!composer.lock' \
':!*/composer.json' \
':!lib/web/tiny_mce/*' \
':!CHANGELOG.md' \
':!CONTRIBUTING.md'
# Basic example:
ffmpeg -ss 00:01 -t 13 -i source.mp4 cropped.mp4
ffmpeg -i cropped.mp4 -vf palettegen palette.png
ffmpeg -i cropped.mp4 -i palette.png -lavfi "fps=15,paletteuse" output.gif
# Advanced example
ffmpeg -ss 00:00 -t 10 -i screencast.mp4 -filter:v "crop=width:height:x:y" -strict -2 cropped.mp4
ffmpeg -i cropped.mp4 -vf palettegen palette.png
ffmpeg -ss 00:00 -t 5 -i cropped.mp4 -i palette.png -lavfi "fps=15,scale=450:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gif
@vovayatsyuk
vovayatsyuk / Update all repos
Last active August 9, 2017 14:40
Update all git repositories in one command
cd folder/with/repos;
for module in *; do cd $module && git checkout master && git pull && cd ../; done;
@vovayatsyuk
vovayatsyuk / magento2-development.md
Last active November 11, 2019 19:04
Magento2 development snippets

Search Patterns

Css
app/design/frontend/Magento,lib/web/css,*.less,-**/docs/*

Clear preprocessed and generated scripts and styles

@vovayatsyuk
vovayatsyuk / Default (Linux).sublime-keymap
Last active December 28, 2023 13:40
Sublime settings and plugins
[
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line.sublime-macro"} },
{ "keys": ["ctrl+shift+r"], "command": "reveal_in_side_bar"},
{ "keys": ["f5"], "command": "refresh_folder_list" },
{ "keys": ["shift+tab"], "command": "unindent", "context":
[
{ "key": "setting.shift_tab_unindent", "operator": "equal", "operand": true }
]
},
{ "keys": ["ctrl+y"], "command": "redo" },
@vovayatsyuk
vovayatsyuk / gist:271e5442ce54709e649b
Created December 8, 2014 09:16
Git submodules for every directory
git init
for module in *; do git submodule add "./$module"; done;
git commit -m "Initial commit"
@vovayatsyuk
vovayatsyuk / gist:8348379
Created January 10, 2014 07:58
List of matched files
https://github.com/colinmollenhour/modman/wiki/Productivity-Hints
$ for lang in locale/*/My_Module.csv; do echo "$lang app/$lang" >> filename.txt; done
@vovayatsyuk
vovayatsyuk / gist:5803147
Created June 18, 2013 06:46
Git: Put changed files to archive
git archive --format=zip new_branch `git diff old_branch new_branch --name-only` > file.zip