Skip to content

Instantly share code, notes, and snippets.

## Magento 2
alias m2="bin/magento"
alias m2rmgen="find var/generation -maxdepth 1 -mindepth 1 -type d -not -name 'Magento' -not -name 'Composer' -not -name 'Symfony' -exec rm -rf {} \;"
alias m2en="m2 module:enable"
alias m2s="m2 module:status"
alias m2f="m2 cache:flush"
alias m2up="m2en --all && m2 setup:upgrade && m2rmgen && m2f"
alias m2static="rm -rf var/view_preprocessed/* && rm -rf pub/static/frontend/* && rm -rf pub/static/_requirejs/frontend/*"
alias m2perm="sudo find . -type d -exec chmod 775 {} \; && sudo find . -type f -exec chmod 664 {} \; && sudo chmod u+x bin/magento"
phpbrew install \
-j $(nproc) 5.6 \
+bcmath \
+bz2 \
+calendar \
+cli \
+ctype \
+curl \
+exif \
+filter \
@tunght13488
tunght13488 / .htaccess
Last active May 16, 2019 15:32
htaccess IP whitelisted rule behind load balancer
# See: http://www.jonathanquail.com/blog/2012/05/09/restricting-access-to-servers-behind-an-elastic-load-balancer/
# Extract client IP
#SetEnvIf REMOTE_ADDR "(.+)" CLIENTIP=$1
# If request is forwarded, use forwarded IP instead
SetEnvIf X-Forwarded-For "^([0-9.]+)" CLIENTIP=$1
# If request is not forwarded, set a flag
SetEnvIf X-Forwarded-For "^$" is_not_forwarded
# Whitelist
SetEnvIf CLIENTIP "173.55.53.87" allowed_in
SetEnvIf CLIENTIP "72.67.47.197" allowed_in
@tunght13488
tunght13488 / hello_design.md
Last active October 28, 2015 16:34
hello design ET

Hello Design

Scott Arenstein

Questions

  • Nếu upgrade thì theme có bị broken ko? Em chém là trong phần info của cái theme đã có nói rõ là supported for the latest Magento version.

  • Backend development của mình làm sao để đảm bảo chất lượng? Em chém là có tester

  • What approach would you recommend for us now that we're going into design?

@tunght13488
tunght13488 / magento.nginx.conf
Created July 17, 2015 11:48
magento.nginx.conf
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
}
## These locations would be hidden by .htaccess normally
location ^~ /app/ { deny all; }
location ^~ /includes/ { deny all; }
location ^~ /lib/ { deny all; }
@tunght13488
tunght13488 / nginx.conf
Created July 17, 2015 04:12
nginx.conf
#user nobody;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
server {
include port/http.conf;
# listen 8080;
server_name laravel.dev;
root /path/to/laravel/public;
index index.php index.html;
@tunght13488
tunght13488 / docker-keygen
Last active March 7, 2016 11:52
Generate docker certs
#!/bin/sh
echo "[$0] Working dir: $PWD"
echo 01 | tee ca.srl
# Create private key ca-key.pem
openssl genrsa -des3 -out ca-key.pem
@tunght13488
tunght13488 / generate-ovpn.sh
Last active March 7, 2016 11:51
Generate unified OpenVPN client profile
#!/bin/sh
# Follow https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-14-04
# Use to quickly generate a client.ovpn file and copy it to destination folder
# Sample: sudo ./generate-ovpn.sh digital-ocean /home/myusername/openvpn
CLIENT="$1"
DEST="$2"
OPENVPN_HOME=/etc/openvpn
@tunght13488
tunght13488 / quadratic-bezier.js
Last active December 15, 2023 10:13
quadratic bezier curve length in javascript
/*
* http://en.wikipedia.org/wiki/B%C3%A9zier_curve
* http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/g
*/
function Point(x, y) {
this.x = x;
this.y = y;
}