Skip to content

Instantly share code, notes, and snippets.

View pvledoux's full-sized avatar

Pv Ledoux pvledoux

View GitHub Profile
@pvledoux
pvledoux / .php_cs
Last active June 28, 2018 11:08
PHP-CS-Fixer PSR-2 config
<?php
return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
'method_separation' => true,
'no_multiline_whitespace_before_semicolons' => true,
'single_quote' => true,
@pvledoux
pvledoux / ApiVersion.php
Created September 12, 2017 09:18
Laravel 5.5 API versioning based header. It's not working because the route has already been binded, but I kept it here for the record
<?php namespace App;
/**
* ApiVersion class
*
* @author pvl
*/
class ApiVersion
{
private static $valid_api_versions = [
	{exp:stash:set_list name="entries" parse_tags="yes"}
		{exp:channel:entries channel="my_channel" orderby="date" sort="desc" dynamic="no" limit="999"}
		    {stash:title}{title}{/stash:title}
		    {stash:date_day}{entry_date format="%d"}{/stash:date_day}
		    {stash:date_month}{entry_date format="%m"}{/stash:date_month}
		    {stash:date_year}{entry_date format="%Y"}{/stash:date_year}
		    {stash:date_sort}{entry_date format="%Y-%F"}{/stash:date_sort}
		    {stash:date_machine}{entry_date}{/stash:date_machine}
		{/exp:channel:entries}

{/exp:stash:set_list}

@pvledoux
pvledoux / Contract Killer 3.md
Created November 8, 2012 15:53
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@pvledoux
pvledoux / config.php
Created October 29, 2012 13:02 — forked from 1stevengrant/config.php
Fixes the daylight savings issue with EE
var $dateTime = new DateTime();
$dateTime->setTimezone(new DateTimeZone('America/New_york'));
$dateTime->setTimestamp(time());
$isDst = (bool)$dateTime->format('I') ? "y" : "n";
$conf['daylight_savings'] = $isDst;
@pvledoux
pvledoux / gist:3326449
Created August 11, 2012 19:06
Apache Cache Control
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "now"
ExpiresByType text/html "now"
ExpiresByType text/xml "now"
ExpiresByType text/css "access plus 8 hours"
ExpiresByType text/plain "access plus 8 hours"
ExpiresByType application/x-javascript "access plus 8 hours"
ExpiresByType application/x-shockwave-flash "access plus 8 hours"
ExpiresByType application/pdf "access plus 8 hours"
@pvledoux
pvledoux / error_db.php
Created August 3, 2012 08:12
Better Error DB file for ExpressionEngine ./system/expressionengine/errors/error_db.php
<html>
<head>
<title>Database Error</title>
<style type="text/css">
body {
background-color: #fff;
margin: 40px;
font-family: Lucida Grande, Verdana, Sans-serif;
font-size: 12px;