Skip to content

Instantly share code, notes, and snippets.

View gido's full-sized avatar

Gilles Doge gido

View GitHub Profile
@gido
gido / deploy.rb
Created December 11, 2012 22:08
Our capifony/capistrano config
# app/config/deploy.rb
#
# Multistage deploy config.
# require capistrano-ext
# see: http://www.zalas.eu/multistage-deployment-of-symfony-applications-with-capifony
#
set :stage_dir, 'app/config/deploy'
require 'capistrano/ext/multistage'
@gido
gido / simple_accordion.html
Created February 9, 2011 18:15
not tested
HTML:
<div class="header with-cool-bottom-background-image"></div>
<div class="container">
<div class="panels">
<div class="panel1" style="display: none">
<h1>Cool Default Content (homepage)</h1>
</div>
<div class="panel2" style="display: none">
<h1>This nice content is hidden by default and will be displayed only on link click below.</h1>
</div>
@gido
gido / blackify hex color
Created December 13, 2010 13:14
Example of a simple script to manipulate hexadecimal color
<?php
$input = "#A2D73A";
if(!preg_match('/#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})/', $input, $matches)){
die(sprintf("Error: '%s' is not a valid hexadecimal color!", $input));
}
$bgColor1 = $input;
$bgColor2 = blackify($input, 60);
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enableAllPluginsExcept('sfDoctrinePlugin');
// if(ENV == "dev"):
$this->setWebDir('/a/path');
// else:
$this->setWebDir('a/different/path');
class MyClass
{
static $choicesMaxChildren = array(
1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
6 => 'Whaaa! more than 5 ?',
);
# routing.yml
language:
class: sfPropelRouteCollection
options:
model: Language
module: language
prefix_path: language
column: id
with_wildcard_routes: true
requirememts: '\w+'
# routing.yml
language:
class: sfPropelRouteCollection
options:
model: Language
module: language
prefix_path: language
column: id
with_wildcard_routes: true
requirememts:
>> app Route "language_edit" for application "backend"
Name language_edit
Pattern /language/:id/edit.:sf_format
Class sfPropelRoute
Defaults action: 'edit'
module: 'language'
sf_format: 'html'
Requirements id: '\\d+'
sf_format: '[^/\\.]+'
sf_method: 'get'
language GET /language.:sf_format
language_new GET /language/new.:sf_format
language_create POST /language.:sf_format
language_edit GET /language/:id/edit.:sf_format
language_update PUT /language/:id.:sf_format
language_delete DELETE /language/:id.:sf_format
language_show GET /language/:id.:sf_format
language_object GET /language/:id/:action.:sf_format
language_collection POST /language/:action/action.:sf_format