Skip to content

Instantly share code, notes, and snippets.

View linxlad's full-sized avatar

Nathan Daly linxlad

  • Bury St Edmunds, England
View GitHub Profile
orm:
auto_generate_proxy_classes: "%kernel.debug%"
entity_managers:
default:
connection: default
auto_mapping: true
dql:
string_functions:
HS_CONCAT_ADDRESS: AppBundle\DQL\HSConcatAddress
mappings:
@linxlad
linxlad / ManualLogin.php
Created April 17, 2015 16:40
Custom Authentication Class with Symfony 2.6
<?php
/**
* @Author: Nathan Daly
* @Date: 17/04/15
*/
namespace AppBundle\Security;
use Doctrine\ORM\EntityManager;
use Symfony\Component\DependencyInjection\Container;
/**
* Initialize form (extended from HouseSimple_Form)
*
* @return void
*/
public function init()
{
$this->setMethod('post');
$this->setAttrib('class', 'Form Form--user');
$this->setAction($this->getView()->url());
/**
* hs.property-questionnaire.js
*
* Property questionnaire scripts.
*/
(function($) {
// Set-up questionnaire namespace.
Hs.questionnaire = {};
@linxlad
linxlad / Version20150701100015.php
Last active August 29, 2015 14:24
Referral Migration
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Create tables for the referral system.
@linxlad
linxlad / Version20150625094625.php
Created July 3, 2015 10:13
Status corrections
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20150625094625
* @package Application\Migrations
@linxlad
linxlad / progress-bar.php
Created July 3, 2015 10:16
CLI progress bar
<?php
printf("\r" . str_repeat("=", round(($key / $count) * 100)) . "> %d%% (%s/%s)", round(($key / $count) * 100), $key, $count);
@linxlad
linxlad / shoutLogic.php
Last active August 29, 2015 14:24
Shout boxes
// Configure any shout boxes
$shoutBoxes = [];
$shouts = $this->entityManager->getRepository('AppBundle:ShoutBox')
->findBy(['active' => 'active', 'deleted' => 0]);
if (!empty($shouts)) {
foreach ($shouts as $shout) {
$shoutBoxes[] = [
'name' => $shout->getName(),
'icon' => '',
// Configure any shout boxes
$shoutBoxes = [];
$shouts = $this->entityManager->getRepository('AppBundle:ShoutBox')
->findBy(['active' => 'active', 'deleted' => 0]);
if (!empty($shouts)) {
foreach ($shouts as $index => $shout) {
$shoutBoxes[$index] = [
'name' => $shout->getName(),
'icon' => '',
@linxlad
linxlad / Buzz.php
Created July 8, 2015 14:05
Buzz Browser Service in Symfony2
<?php
namespace AppBundle\Util;
use Buzz\Browser;
use Buzz\Exception\RequestException;
/**
* Class Buzz
* @package AppBundle\Util