Skip to content

Instantly share code, notes, and snippets.

@JeroenBoersma
JeroenBoersma / NGINX - Magento 2 Static files optimization.md
Last active April 10, 2024 14:26
NGINX - Magento 2 Static files optimization

Introduction

Because Varnish doesn't support SSL, most people choose a setup where Nginx SSL will forward all traffic to Varnish and Varnish will forward will forward the traffic it cannot handle back to nginx. Or worse, bind Varnish on port 80 and direct all traffic into Varnish. This will already degrade performance, because Varnish will purge more because static files are also taking up room in the cache.

Default configuration

Next up, the Nginx configuration of Magento will handle static files.

<?php
class Csv
{
public static function fromArray($rows, $delimiter = ',')
{
if (empty($rows)) {
return '';
}
@barryvdh
barryvdh / Xml.php
Last active January 14, 2021 09:10
XML Helper (from/to array)
<?php
use SimpleXMLElement;
class Xml {
/**
* @param array $data
* @param string $root
* @return SimpleXMLElement
@fedeisas
fedeisas / gist:5862227
Last active December 18, 2015 23:29
Inline CSS Styles on Laravel 4
<?php
/* 1. Add the dependency to your composer.json.
// I'm using https://packagist.org/packages/tijsverkoyen/css-to-inline-styles
*/
/* 2. Extend \Illuminate\Mail\Mailer to override the getView() method
// app/libraries/MyApp/Mailer.php
*/
namespace MyApp\Mail;
@purwandi
purwandi / deploy.rb
Created November 19, 2012 13:09
Laravel Capistrano Receipes
set :application, "App Name" # Your app name
set :repository, "git@github.com:xxxxx/xxx.git" # Your git repository
set :document_root, "/home/user/www/awesome_app"
set :deploy_via, :remote_cache
# SSH Settings
set :user, "user_ssh"
set :password, "password_ssh"
set :use_sudo, false
@ziadoz
ziadoz / awesome-php.md
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@scottjehl
scottjehl / hideaddrbar.js
Created August 31, 2011 11:42
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@rk
rk / bcrypt.php
Last active January 4, 2018 13:15
Simple bcrypt object to wrap crypt() with.
<?php
// Originally by Andrew Moore
// Src: http://stackoverflow.com/questions/4795385/how-do-you-use-bcrypt-for-hashing-passwords-in-php/6337021#6337021
//
// Heavily modified by Robert Kosek, from data at php.net/crypt
class Bcrypt {
private $rounds;
private $prefix;