Skip to content

Instantly share code, notes, and snippets.

Avatar

Gilles Doge gido

View GitHub Profile
View gist:103118
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
View gist:103123
>> 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'
View gist:103148
# routing.yml
language:
class: sfPropelRouteCollection
options:
model: Language
module: language
prefix_path: language
column: id
with_wildcard_routes: true
requirememts:
View gist:103158
# routing.yml
language:
class: sfPropelRouteCollection
options:
model: Language
module: language
prefix_path: language
column: id
with_wildcard_routes: true
requirememts: '\w+'
View gist:115416
class MyClass
{
static $choicesMaxChildren = array(
1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
6 => 'Whaaa! more than 5 ?',
);
View gist:246306
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enableAllPluginsExcept('sfDoctrinePlugin');
// if(ENV == "dev"):
$this->setWebDir('/a/path');
// else:
$this->setWebDir('a/different/path');
@gido
gido / blackify hex color
Created Dec 13, 2010
Example of a simple script to manipulate hexadecimal color
View blackify hex 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);
View simple_accordion.html
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 / deploy.rb
Created Dec 11, 2012
Our capifony/capistrano config
View deploy.rb
# 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 / macosx-install-php-oracle-oci8.md
Last active Jun 1, 2021
install Oracle PHP Extension (oracle OCI8) - instantclient for Mac OS 10.8 - homebrew environnement
View macosx-install-php-oracle-oci8.md

Installation

This procedure is tested on Mac OS X 10.8 with Developpers tools installed (xCode).

PHP 5.4 installed with Homebrew.

Update: I wrote a blog post about this.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):