Skip to content

Instantly share code, notes, and snippets.

View MikSDigital's full-sized avatar
🎯
Focusing

Mikhail MikSDigital

🎯
Focusing
View GitHub Profile
@MikSDigital
MikSDigital / ApiSubscriptionController.php
Created March 21, 2017 08:40
ApiSubscriptionController.php
<?php
namespace Email\EmailBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use FOS\RestBundle\View\View;
public function getIdByEmail($sEmail)
{
$aResult = $this->getEntityManager()
->createQuery("SELECT user.id FROM EducationBaseBundle:User user WHERE user.mail = :mail")
->setParameter('mail', $sEmail)
->getOneOrNullResult();
if (isset($aResult['id'])) {
return $aResult['id'];
}
return 0;
return $this->get('fos_rest.view_handler')
->handle(
View::create()
->setStatusCode(200)
->setData(array(
'id'=> $oUserRepo->getIdByEmail($userMail),
'userEmail' => $userMail
))
);
@MikSDigital
MikSDigital / gitflow-breakdown.md
Created March 25, 2017 14:49 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

@MikSDigital
MikSDigital / composer.json
Created March 29, 2017 10:41 — forked from spekkionu/composer.json
Standalone validation using laravel validation component
{
"name": "spakkionu/validate",
"description": "Validation Test",
"require": {
"illuminate/validation": "~4.2.9"
},
"license": "MIT",
"authors": [
{
"name": "Jonathan Bernardi",
@MikSDigital
MikSDigital / contact.html.twig
Created March 30, 2017 15:22 — forked from michaelcullum/contact.html.twig
Contact Form for Silex
{% extends layout %}
{% block body %}
<div id="main">
<h2>Contact me</h2>
<p>For queries about anything on this website, or for job quotations, please contact me using the contact form below or via <a href="mailto:[email protected]">email</a>.</p>
<form action="#" method="post">
{{ form_start(form) }}
{{ form_errors(form) }}
@MikSDigital
MikSDigital / scrollTo.js
Created March 31, 2017 05:58
scrollTo.js scrolling on Click
<script>
$(document).ready(function () {
var formErrors = '';
if(formErrors) {
scrollToTitle();
}
@MikSDigital
MikSDigital / CSVImportCommand.php
Created April 27, 2017 15:32 — forked from zajca/CSVImportCommand.php
Symfony2 custom command for import CSV
<?php
namespace PRIA\QuizApiBundle\Command;
use PRIA\Bundle\UserBundle\EntityRepository\RoundsRepository;
use PRIA\QuizApiBundle\Entity\Answers;
use PRIA\QuizApiBundle\Entity\Questions;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@MikSDigital
MikSDigital / parseCSV.php
Created May 2, 2017 06:00
Symfony parseCSV command example (diffrent approach)
<?php
namespace AppBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@MikSDigital
MikSDigital / CSVread.php
Created May 2, 2017 15:10
another example of CSV file reading/parsing
<?php
namespace AppBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;