Skip to content

Instantly share code, notes, and snippets.

View ClaudioVarandas's full-sized avatar

Cláudio Varandas ClaudioVarandas

  • Lisbon Portugal
  • 07:43 (UTC +01:00)
View GitHub Profile
/* Laravel Helpers */
class Helpers
{
public static function setActive($paths = [], $active = 'active')
{
$isActive = false;
foreach ($paths as $path) {
@ClaudioVarandas
ClaudioVarandas / vagrant_apache.yaml
Last active August 29, 2015 14:25
Vagrant configuration apache+factcgi fpm
vagrantfile:
target: local
vm:
box: puphpet/ubuntu1404-x64
box_url: puphpet/ubuntu1404-x64
hostname: xxxxxxxxx
memory: '2048'
cpus: '2'
chosen_provider: parallels
network:
@ClaudioVarandas
ClaudioVarandas / gist:5b5251c177abce78e223
Created March 18, 2015 10:40
Generate unique slugs in Laravel 4 (updated)
function generateSlug($value)
{
$slug = \Str::slug($value);
$slugs = $this->whereRaw("slug REGEXP ? ", ["^{$slug}(-[0-9]*)?$"]);
$count = $slugs->count();
if ($count === 0) {
return $slug;
@ClaudioVarandas
ClaudioVarandas / gist:33f5b4588c1d2daa777e
Created December 1, 2014 18:32
Header AUTH Apache to PHP FPM
<VirtualHost *>
ServerName auth.dev
DocumentRoot "/var/www/auth"
ProxyPassMatch ^(/.*\.php)$ fcgi://127.0.0.1:9000/var/www/auth
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</VirtualHost>