Skip to content

Instantly share code, notes, and snippets.

@bigfoot90
bigfoot90 / TelegramAuthenticator.php
Created February 13, 2020 20:50
Symfony Telegram Authenticator
<?php
namespace App\Security;
use App\Models\Entity\User;
use App\Models\ValueObject\TelegramAccount;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@bigfoot90
bigfoot90 / ConsumerTest.php
Last active March 5, 2020 14:57
PHPacto Symfony integration test
<?php
use Bigfoot\PHPacto\PHPacto;
use Bigfoot\PHPacto\Guzzle\ProviderMock;
use Bigfoot\PHPacto\Guzzle\ProviderMockGuzzle6;
use Bigfoot\PHPacto\Loader\PactLoader;
use GuzzleHttp\Client as GuzzleClient;
use PHPUnit\Framework\TestCase;
class Consumer
@bigfoot90
bigfoot90 / CarPark.sql
Created October 27, 2015 04:38
Returns the number of 'Audi', 'BMW' and 'Mercedes' cars grouped by year
SELECT
q.year,
(SELECT COUNT(q1) FROM AppBundle\Entity\CarPark q1 WHERE q1 = q AND q1.producer = "Audi") AS Audi
(SELECT COUNT(q1) FROM AppBundle\Entity\CarPark q1 WHERE q1 = q AND q1.producer = "BMW") AS BMW
(SELECT COUNT(q1) FROM AppBundle\Entity\CarPark q1 WHERE q1 = q AND q1.producer = "Mercedes") AS Mercedes
FROM AppBundle\Entity\CarPark q
GROUP BY q.year
ORDER BY q.year ASC
var eventiply = {};
eventiply.formToArray = function(form){
var postVars = {};
$(form).find('input').each(function(i,obj){
postVars[$(obj).attr('name')] = $(obj).val();
});
$(form).find('select').each(function(i,obj){
postVars[$(obj).attr('name')] = $(obj).val();