Skip to content

Instantly share code, notes, and snippets.

View viccherubini's full-sized avatar
🚀
Zooming

Vic Cherubini viccherubini

🚀
Zooming
View GitHub Profile
@viccherubini
viccherubini / Vagrantfile
Last active December 27, 2015 06:59
Expert PHP Deployments Vagrantfile
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
config.vm.provision :shell, :path => "config/vagrant-bootstrap.sh"
# Create a forwarded port mapping.
config.vm.network :forwarded_port, guest: 8000, host: 8000, auto_correct: true
@viccherubini
viccherubini / deploy.rb
Last active December 26, 2015 23:59
Advanced Web Applications Using Symfony Capistrano deploy.rb configuration script.
# Deployment remotes
set :stages, %w(production staging)
set :default_stage, 'staging'
require 'capistrano/ext/multistage'
# Repo options
set :application, 'MajorAuth'
set :repository, 'git@github.com:brightmarch/major-auth.git'
set :scm, :git
@viccherubini
viccherubini / Capfile
Created October 30, 2013 11:07
Advanced Web Applications Using Symfony Capfile
load 'deploy'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
namespace :deploy do
task :install_composer, :roles => :web do
run "curl -s https://getcomposer.org/installer | php -- --install-dir=#{latest_release}"
end
@viccherubini
viccherubini / iptables.up.rules
Created October 30, 2013 01:52
Advanced Web Applications Using Symfony iptables configuration rules.
*filter
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allows all outbound traffic
@viccherubini
viccherubini / vhost-majorauth.conf
Last active December 26, 2015 20:28
Advanced Web Applications Using Symfony Nginx virtual host configuration file.
server {
listen 80;
server_name majorauth.com www.majorauth.com;
return 301 https://majorauth.com$request_uri;
}
server {
listen 443;
server_name majorauth.com;
@viccherubini
viccherubini / nginx.conf
Last active December 26, 2015 17:49
Advanced Web Applications Using Symfony nginx.conf configuration file.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
@viccherubini
viccherubini / virtual-host.conf
Created October 26, 2013 21:47
Static site Nginx configuration.
server {
listen 80;
server_name example.com example.net example.org www.example.com www.example.net www.example.org;
# If the Host header begins with www.
# then strip off the www. and redirect
# to the URL without the www. prefix.
if ($host ~* ^www\.(.+)) {
return 301 $scheme://$1$request_uri;
}
@viccherubini
viccherubini / AuthenticationControllerTest.php
Created October 20, 2013 13:07
Symfony test memory usage
<?php
class AuthenticationControllerTest
{
public function testAccountCanNotAccessAdministration()
{
$client = static::createClient();
$crawler = $client->request('GET', '/authentication/sign-in');
$container = $client->getKernel()
@viccherubini
viccherubini / compile
Created October 15, 2013 15:42
compile script for generating Advanced Web Applications book
#!/bin/bash
BOOKSRC=AWA-PHP.md
BOOKPDF=AWA-PHP.pdf
BOOKHTML=AWA-PHP.html
pandoc $BOOKSRC -o $BOOKHTML
prince --verbose --media=print $BOOKHTML -o $BOOKPDF
@viccherubini
viccherubini / build.settings.template
Created October 6, 2013 03:18
Advanced Web Applications Using Symfony build.settings.template file.
db_settings.host=localhost
db_settings.database=major_auth
db_settings.username=major_auth
db_settings.password=
db_settings_test.host=localhost
db_settings_test.database=major_auth_test
db_settings_test.username=major_auth_test
db_settings_test.password=