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 / 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=
@viccherubini
viccherubini / parameters.yml.template
Last active December 24, 2015 19:18
Advanced Web Applications Using Symfony parameters.yml.template configuration file.
parameters:
database_driver: "pdo_pgsql"
database_host: "@@DB_SETTINGS_HOST@@"
database_port: ~
database_name: "@@DB_SETTINGS_DATABASE@@"
database_user: "@@DB_SETTINGS_USERNAME@@"
database_password: "@@DB_SETTINGS_PASSWORD@@"
test_database_driver: "pdo_pgsql"
test_database_host: "@@DB_SETTINGS_TEST_HOST@@"
@viccherubini
viccherubini / Vagrantfile
Created October 5, 2013 21:03
Advanced Web Applications Vagrantfile script.
# 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 => "app/config/vagrant-bootstrap.sh"
# Create a forwarded port mapping.
config.vm.network :forwarded_port, guest: 8000, host: 8000, auto_correct: true
@viccherubini
viccherubini / build.xml
Last active December 23, 2015 21:09
Advanced Web Applications Phing build.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<project name="MajorAuth" default="build">
<resolvepath propertyName="root_path" file="./" />
<resolvepath propertyName="config_path" file="./app/config/" />
<php function="date" returnProperty="build_date">
<param value="c" />
</php>
<php function="time" returnProperty="build_timestamp" />
@viccherubini
viccherubini / client.php
Created September 6, 2013 21:32
The Trendline - Issue #3 - Building a Service With ZeroMQ Part 2 - ZeroMQ Client
<?php
define('CUSTOMER_EMAIL', '[email protected]');
$context = new ZMQContext();
// This socket is a request socket meaning
// it makes requests to a bound IP address
// and port.
$requester = new ZMQSocket($context, ZMQ::SOCKET_REQ);
@viccherubini
viccherubini / server.php
Created September 6, 2013 21:31
The Trendline - Issue #3 - Building a Service With ZeroMQ Part 2 - ZeroMQ Server
<?php
define('ACTION_LOOKUP', 'lookup');
define('ACTION_ADD', 'add');
// Create a new ZeroMQ context. You only ever want one
// context for each process. The context is essentially the
// container for all of the sockets you will be creating
// through the course of the application.
$context = new ZMQContext(1);