Skip to content

Instantly share code, notes, and snippets.

View rawroland's full-sized avatar

Roland Awemo rawroland

View GitHub Profile
<?php
...
public function loginAction() {
if($this->authorizationChecker->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->dashboardAction();
}
$lastEmail = $this->authentication->getLastUsername();
$error = $this->authentication->getLastAuthenticationError();
@rawroland
rawroland / gist:182aa73caa3501286ccaedb1dc99decc
Created July 26, 2016 18:21 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="autoload.php"
>
<php>
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;
UPDATE users AS User
INNER JOIN admins AS Admin on Admin.user_id = User.id
INNER JOIN events AS Event ON Event.id = Admin.school_id AND Event.id IN (115, 116, 117)
SET password = 'super secure password';
<?php
$date = DateTime::createFromFormat(static::DATE_FORMAT, "$year-12-31");
$numberOfDays = $date->format('z');
?>
@rawroland
rawroland / habtm_form.php
Last active October 8, 2015 10:58
How a select field for an HABTM relationship is to be arranged.
echo $this->Form->input($associationModelName, ['type' => 'select', 'multiple' => true]);
@rawroland
rawroland / git-tag-hash
Created September 21, 2015 14:40
Commit hash for a tag.
git rev-list -1 <TAG>
public function importXmlCache() {
$this->ImportXmlCache->execute();
$this->ImportTerminationXmlCache->execute();
}