Skip to content

Instantly share code, notes, and snippets.

View viccherubini's full-sized avatar
🎯
Focusing

Vic Cherubini viccherubini

🎯
Focusing
View GitHub Profile
<?php
function array_value($key, $search, $default=NULL, $callback=NULL) {
$value = $default;
if ( array_key_exists($key, $search) ) {
$value = $search[$key];
$value = ( function_exists($callback) ? $callback($value) : $value);
}
@viccherubini
viccherubini / openssl-example.php
Created February 20, 2012 21:23
OpenSSL PHP example
<?php
class protector {
private $passphrase = null;
private $private_key = null;
private $public_key = null;
public function __construct() {
@viccherubini
viccherubini / build.xml
Created November 10, 2012 11:26
Symfony Phing build.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project name="Sample Symfony Application" default="build">
<resolvepath propertyName="root_path" file="./" />
<resolvepath propertyName="config_path" file="./app/config/" />
<php function="date" returnProperty="build_date">
<param value="c" />
</php>
@viccherubini
viccherubini / vhost-expert-php-applications.conf
Created November 4, 2013 03:24
Expert PHP Deployments Nginx virtual host configuration file.
server {
listen 80;
server_name expertphpdeployments.com www.expertphpdeployments.com;
return 301 https://expertphpdeployments.com$request_uri;
}
server {
listen 443;
server_name expertphpdeployments.com;
@viccherubini
viccherubini / nginx.conf
Created November 4, 2013 03:19
Expert PHP Deployments nginx.conf configuration file.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
@viccherubini
viccherubini / build.xml
Last active December 27, 2015 08:09
Expert PHP Deployments Phing build.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<project name="Your Application" 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 / parameters.yml.template
Created November 3, 2013 12:52
Expert PHP Deployments parameters.yml.template 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 / build.settings.template
Created November 3, 2013 12:47
Expert PHP Deployments build.settings.template file.
db_settings.host=localhost
db_settings.database=application
db_settings.username=application
db_settings.password=
db_settings_test.host=localhost
db_settings_test.database=application_test
db_settings_test.username=application_test
db_settings_test.password=
@viccherubini
viccherubini / build-dev
Created November 3, 2013 12:31
Expert PHP Deployments build-dev script.
#!/bin/bash
PHPMINVERSION='5.5.0'
PHPVERSION=`php -r "echo phpversion();"`
PHPCORRECTVERSION=`php -r "echo version_compare(phpversion(), '$PHPMINVERSION');"`
GREEN="\033[1;32m"
RED="\033[1;31m"
BLUE="\033[1;34m"
YELLOW="\033[1;33m"
@viccherubini
viccherubini / vagrant-bootstrap.sh
Last active December 27, 2015 06:59
Expert PHP Deployments Vagrant bootstrap file.
#!/usr/bin/env bash
# If Vagrant has already been provisioned, do not do anything.
# This saves us from accidentally running `vagrant up` without the --no-provision
# flag and messing up the box.
VAGRANT_PROVISIONED=/etc/vagrant-provisioned
if [ -e $VAGRANT_PROVISIONED ]
then
exit 0