These are the default files that I will usually start with when setting up a symfony2 project to use vagrant and puppet. I'm putting this readme file here for future updates.
Make sure the files that end in .sh
are executable.
#!/bin/sh | |
### | |
# | |
# Runs phpcs to check for violations | |
# | |
PHPCS_BIN=$(command -v phpcs) | |
if [ ! $PHPCS_BIN ]; then | |
exit 0 | |
fi |
mysql -u USERNAME -p DATABASE -e "select * from TABLE;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' |
{% set email_class = '' %} | |
{% if form.email.vars.errors %} | |
{% set email_class = 'error' %} | |
{% endif %} | |
{{ form_label(form.email, 'Email', {'label_attr':{'class':email_class}}) }} | |
{{ form_widget(form.email, {'attr':{'class':email_class}}) }} | |
{% if form.email.vars.errors %} | |
{% for error in form.email.vars.errors %} | |
<small class="error">{{ error.message }}</small> |
<form id="that-one-form"> | |
{{ form_widget(form) }} | |
</form> |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise64" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
config.vm.network :forwarded_port, guest: 80, host: 8080 | |
config.vm.network :private_network, ip: "192.168.33.10" | |
config.vm.synced_folder ".", "/var/www/app.local", :nfs => true | |
config.vm.provider :virtualbox do |vb| |
<?php | |
// get the sha512 hash of the txid and split it by 2 | |
$pool = str_split(hash_hmac('sha512', $txid, $DailySecretKey), 2); | |
// Loop and get 20 | |
for($N=array(),$i = 0; count($N) < 20 && $i < count($pool); $i++) { | |
// base 10 that shit | |
$n = hexdec($pool[$i]); | |
// make sure it meets the standards | |
if ($n > 80 || $n < 1) { |
<?php | |
/** | |
* This function will take an array and select n from it | |
* without replacement. This can be used as a random number | |
* generator | |
* | |
* Example: I want to select $n numbers from a pool of $N numbers | |
* <code> | |
* $values = $srs(range(1,100), 5); | |
* </code> |
<?php | |
/** | |
* Computes the factorial of $n | |
* @param interger $n Number you want to find the factorial for | |
* @return string | |
*/ | |
$factorial = function($n) { | |
for($k=1, $i=1;$i <= $n;$i++) { | |
$k = $k * $i; |