Skip to content

Instantly share code, notes, and snippets.

<div class="row-fluid">
<form action="" method="post">
<fieldset>
<legend>{% trans %}Login{% endtrans %}</legend>
<div class="control-group">
<label class="control-label" for="_username">{% trans %}Username :{% endtrans %}</label>
<div class="controls">
<input type="text" name="_username" id="_username" value="{{ last_username }}">
public function relativeDate($date)
{
$today = strtotime(date('M j, Y'));
if ($date instanceof \DateTime) {
$date = $date->getTimestamp();
}
$reldays = ($date - $today) / 86400;
<?php
namespace Geekswire\Egames\SteamBundle\Manager;
class L4D2ServerManager
{
/**
* @var \SourceServer
*/
private $serverConnexion;
{#
This file is part of the Glit package.
(c) William Pottier <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% block form_widget %}
{% spaceless %}
<?php
namespace Formation\CoreBundle\Listener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
class LocaleListener implements EventSubscriberInterface
{
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>global.hello</source>
<target>Bonjour</target>
</trans-unit>
</body>
</file>
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__ . '/../app/bootstrap.php.cache';
if(!isset($_SERVER['APPLICATION_ENV'])) {
$_SERVER['APPLICATION_ENV'] = (in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))) ? 'dev' : 'prod';
}
$datetime_transformer = new \Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer(null, null, 'Y-m-d H:i:s');
$timestamp_transformer = new \Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer();
# Transforming to Timestamp
if (!($from_time instanceof \DateTime) && !is_numeric($from_time)) {
$from_time = $datetime_transformer->reverseTransform($from_time);
$from_time = $timestamp_transformer->transform($from_time);
} elseif($from_time instanceof \DateTime) {
$from_time = $timestamp_transformer->transform($from_time);
}
<?php
namespace Mon\Site\BlogBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class BaseEntity
*
* @ORM\MappedSuperclass

OS X ENV (re)Install

This is my personal guide to restore my configuration and setup my system for a fresh install. I use it and keep it updated frequently. Hope it will inspire you on your own way =].

Backup

Before a fresh reinstall, don't forget to backup many things. A regular ghost made with CarbonCopyCloner is a good solution, but if you can't, you should save the following :