Skip to content

Instantly share code, notes, and snippets.

View kriswallsmith's full-sized avatar

Kris Wallsmith kriswallsmith

  • Portland, Oregon USA
  • 00:40 (UTC -07:00)
View GitHub Profile
<service id="swiftmailer.message" class="Swift_Message" factory-method="newInstance" shared="false">
<file>%swiftmailer.init_file%</file>
<argument>null</argument>
<argument>null</argument>
<argument>null</argument>
<argument>%kernel.charset%</argument>
<call method="setFrom">
<argument>noreply@example.com</argument>
</call>
</service>
<?php
class Tag
{
public function normalizeName($name)
{
$normal = trim($name);
$normal = strtolower($normal);
return $normal;
@kriswallsmith
kriswallsmith / HostAwareRoute.php
Created October 3, 2010 07:17
A symfony 1 route that includes host in the pattern
<?php
class HostAwareRoute extends sfRequestRoute
{
protected
$hostRoute = null;
public function __construct($pattern, array $defaults = array(), array $requirements = array(), array $options = array())
{
if ('/' != $pattern[0])
@mixin gradient($start, $end, $type: "vertical") {
@if "vertical" == $type {
background: -webkit-gradient(linear, left top, left bottom, from($start), to($end));
background: -moz-linear-gradient(top, $start, $end);
filter: progid:DXImageTransform.Microsoft.gradient(StartColorStr='#{$start}', EndColorStr='#{$end}');
} @else if "horizontal" == $type {
background: -webkit-gradient(linear, left top, right top, from($start), to($end));
background: -moz-linear-gradient(left, $start, $end);
filter: progid:DXImageTransform.Microsoft.gradient(StartColorStr='#{$start}', EndColorStr='#{$end}', GradientType=1);
} @else {
# my php configure command for mac os x and homebrew
./configure --sysconfdir=/private/etc --with-apxs2=/usr/sbin/apxs --enable-cli --with-config-file-path=/etc --with-libxml-dir=/usr/local/Cellar/libxml2/2.7.7 --with-openssl=/usr --with-kerberos=/usr --with-zlib=/usr --enable-bcmath --with-bz2=/usr --enable-calendar --with-curl=/usr --enable-exif --enable-ftp --with-gd --with-jpeg-dir=/usr/local/Cellar/jpeg/8b --with-png-dir=/usr/local/Cellar/libpng/1.2.44 --enable-gd-native-ttf --with-ldap=/usr --with-ldap-sasl=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock --with-iodbc=/usr --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-xmlrpc --with-iconv-dir=/usr --with-xsl=/usr --enable-zend-multibyte --enable-zip --with-pcre-regex=/usr/local/Cellar/pcre/8.10 --with-readline=/usr/local/Cellar/readline/6.1 --with-mcrypt=/usr/local/Cellar/mcrypt/2.5
<?php
/**
* A work in progress for dumping a form class into HTML and PHP markup
* suitable for a template file.
*
* @author Kris Wallsmith <kris.wallsmith@symfony-project.com>
*/
class sfGenerateFormScaffoldingTask extends sfTaskExtraGeneratorBaseTask
{
<?php
class aPage extends PluginaPage
{
/**
* A shortcut method for loading fixture data.
*
* With this method in place you can simplify your aPage fixture file to a
* much more concise syntax using the "initial_areas" entry.
*
<?php
class Query extends Doctrine_Query
{
protected
$_disableLimitSubquery = false;
/**
* Disables the limit subquery for the current query object.
*/
/**
* Enhance your Symfony 2 kernel to check for a local configuration file.
*/
public function registerContainerConfiguration()
{
$loader = new ContainerLoader($this->getBundleDirs());
$configuration = $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
// check for a local configuration file
# allows symfony cc to work when a dev doesn't have APC installed
prod:
# <?php if (extension_loaded('apc')): ?> #
view_cache:
class: sfAPCCache
routing:
cache:
class: sfAPCCache
# <?php endif; ?> #