Skip to content

Instantly share code, notes, and snippets.

View guillaumepotier's full-sized avatar
🐝
.

Guillaume Potier guillaumepotier

🐝
.
View GitHub Profile
@todd
todd / state_validator.coffee
Created February 17, 2013 08:18
State abbreviation validator for Parsley.js in CoffeeScript.
$("#multipage").parsley
validators:
state: (val)->
val.toUpperCase() in [
'AK','AL','AR','AS','AZ','CA','CO','CT','DC','DE','FL','GA','GU','HI',
'IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MH','MI','MN','MO',
'MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA',
'PR','PW','RI','SC','SD','TN','TX','UT','VA','VI','VT','WA','WI','WV',
'WY'
]
@pborreli
pborreli / YourCommand.php
Last active August 23, 2020 09:48
Show progress of a file download inside Symfony 2.3 console #howto
<?php
protected function execute(InputInterface $input, OutputInterface $output)
{
$progress = $this->getHelperSet()->get('progress');
$ctx = stream_context_create(array(), array('notification' => function ($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) use ($output, $progress) {
switch ($notification_code) {
case STREAM_NOTIFY_FILE_SIZE_IS:
$progress->start($output, $bytes_max);
break;
@webmozart
webmozart / array-validation-error-mapping.php
Last active November 9, 2024 19:58
A little experiment: Validating (potentially multi-leveled) arrays with the Symfony2 Validator component and returning the errors in the same data structure as the validated array by using the Symfony2 PropertyAccess component.
<?php
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Optional;
use Symfony\Component\Validator\Constraints\Required;
@rgazelot
rgazelot / gitconfig
Last active December 18, 2019 09:36
Install Mac OS X

PHP/Apache MAC OS X

Install php

  1. Liip
  2. In ~/.bash_profile define wich php the system will use :
PATH=/usr/local/php5/bin:$PATH

Configure apache

Create vhosts

@Remiii
Remiii / README.md
Last active August 29, 2015 14:01
Node & NPM installation on Ubuntu 12.04