Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthéo Geoffray mgeoffray

View GitHub Profile
@mgeoffray
mgeoffray / m2-generate-phpstorm-urn.sh
Created Jan 15, 2017
Magento 2 - Generate PhpStorm URN
View m2-generate-phpstorm-urn.sh
function m2_generate_phpstorm_urn() {
bin/magento dev:urn-catalog:generate .idea/misc.xml
}
@mgeoffray
mgeoffray / init-dev-env-mag1.sh
Last active Jan 15, 2017
Magento 1 - Initialize development environment using n98-magerun
View init-dev-env-mag1.sh
function init_dev_env_mag1() {
n98mr config:set dev/log/active 1
n98mr config:set dev/template/allow_symlink 1
n98mr config:set web/cookie/cookie_httponly 0
n98mr config:set web/cookie/cookie_path ""
n98mr config:set web/cookie/cookie_domain ""
n98mr config:set dev/js/merge_files 0
n98mr config:set dev/css/merge_files 0
n98mr config:set dev/css/merge_css_files 0
n98mr config:set admin/security/session_cookie_lifetime 7200
@mgeoffray
mgeoffray / m2-apply-permissions.sh
Created Jan 15, 2017
Magento 2 - Apply default permissions
View m2-apply-permissions.sh
function m2_apply_permissions() {
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find ./var -type d -exec chmod 755 {} \;
find ./pub/media -type d -exec chmod 755 {} \;
find ./pub/static -type f -exec chmod 644 {} \;
find ./pub/static -type d -exec chmod 755 {} \;
chmod 755 ./app/etc
chmod 644 ./app/etc/*.xml
chmod u+x bin/magento
@mgeoffray
mgeoffray / init-dev-env-mag2.sh
Created Jan 15, 2017
Magento 2 - Initialize development environment using n98-magerun2
View init-dev-env-mag2.sh
function init_dev_env_mag2() {
n98mr2 deploy:mode:set developer
n98mr2 config:set dev/log/active 1
n98mr2 config:set dev/template/allow_symlink 1
n98mr2 config:set web/cookie/cookie_httponly 0
n98mr2 config:set web/cookie/cookie_path ""
n98mr2 config:set web/cookie/cookie_domain ""
n98mr2 config:set dev/js/merge_files 0
n98mr2 config:set dev/css/merge_files 0
n98mr2 config:set dev/css/merge_css_files 0
@mgeoffray
mgeoffray / mkcd.sh
Created Jan 15, 2017
Bash - Create directory(ies) and cd into it / them
View mkcd.sh
function mkcd() {
mkdir -p $1 && cd "$_"
}
@mgeoffray
mgeoffray / get-pageload-time.sh
Created Jan 15, 2017
Bash - Get page load time informations
View get-pageload-time.sh
function get_pageload_time() {
curl -w "time_namelookup: %{time_namelookup}\ntime_connect: %{time_connect}\ntime_appconnect: %{time_appconnect}\ntime_pretransfer: %{time_pretransfer}\ntime_redirect: %{time_redirect}\ntime_starttransfer: %{time_starttransfer}\n----------\ntime_total: %{time_total}\n" -o /dev/null -s "$1"
}
@mgeoffray
mgeoffray / get-http-status.sh
Created Jan 15, 2017
Bash - Get page HTTP status code
View get-http-status.sh
function get_http_status() {
curl -s -o /dev/null -I -w "%{http_code}\n" $1
}
You can’t perform that action at this time.