Configs exist in three levels:
- local
- dev | stg | prod
- default (no environment)
There are three types of configs:
<?php | |
namespace MyCompany\Bundle\MyBundle\Command; | |
use Symfony\Bundle\FrameworkBundle\Command\Command; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\HttpFoundation\Request; |
<?php | |
class Bijective | |
{ | |
public $dictionary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
public function __construct() | |
{ | |
$this->dictionary = str_split($this->dictionary); | |
} |
#!/usr/bin/php | |
<?php | |
$processUser = posix_getpwuid(posix_geteuid()); | |
$name = $processUser['dir'].'/mail/'.date('Y-m-d H:i:s').'-'.microtime(true).'.eml'; | |
if (!is_dir($dir = dirname($name))) { | |
mkdir($dir, 0777, true); | |
} | |
$fh = fopen($name, "w"); | |
if (!$fh) { | |
die(1); |
// An example controller binded to the form | |
function FormCntl($scope, $compile) { | |
// Consider using FosJsRouting bundle, if you want to use a Symfony2 route | |
$scope.formUrl = "http://url-to-fetch-my-form"; | |
// Data from the form will be binded here | |
$scope.data = {}; | |
// Method called when submitting the form | |
$scope.submit = function() { |
<?php | |
/** | |
* Optimized version of attribute source options model | |
* | |
* That allows to preload options once and reuse them instead of doing calls to db all the time | |
* | |
*/ | |
class EcomDev_Optimization_Model_Resource_Attribute_Source_Table | |
extends Mage_Eav_Model_Entity_Attribute_Source_Table |
@ECHO off | |
set "script_path=%~dp0" | |
set "script_path=%script_path%my_script.py" | |
python %script_path% %* |
#!/bin/bash | |
set -e | |
set -u | |
set -o pipefail | |
COMMAND=${1:-"help"} | |
MACHINE_NAME=myapp | |
DENV=${DENV:-"dev"} |