Skip to content

Instantly share code, notes, and snippets.

View St0iK's full-sized avatar
☘️
🇬🇷

Dimitris Stoikidis St0iK

☘️
🇬🇷
View GitHub Profile
var App = {
myProperty : 'someValue',
jqueryVar1 : $('.someClass'),
jqueryVar2 : $('.someOtherClass'),
jqueryVar3 : $('#id'),
myConfig:{
useCaching:true,
language: 'en'
},
<?php
/**
* Implements hook_form_alter().
*
* Redirects user logins to the front page.
*/
function HOOK_form_user_login_alter(&$form, &$form_state) {
$form['#action'] = url('user', array('query' => array('destination' => '<front>')));
}
@St0iK
St0iK / sublime-text-3-setup.md
Last active September 12, 2015 16:15 — forked from ijy/sublime-text-3-setup.md
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@St0iK
St0iK / FormErrorsSerializer.php
Created March 15, 2017 23:08 — forked from Graceas/FormErrorsSerializer.php
Symfony 2 Form Error Serializer. May be used for AJAX form validation. Allows tree and flat array styles for errors.
class FormErrorsSerializer {
public function serializeFormErrors(\Symfony\Component\Form\Form $form, $flat_array = false, $add_form_name = false, $glue_keys = '_')
{
$errors = array();
$errors['global'] = array();
$errors['fields'] = array();
foreach ($form->getErrors() as $error) {
$errors['global'][] = $error->getMessage();
@St0iK
St0iK / FooController.php
Created April 17, 2017 11:33 — forked from weaverryan/FooController.php
Autowiring controller args
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Psr\Log\LoggerInterface;
/**
* This class is now a service, so you can use normal __construct DI if you want!
*/
@St0iK
St0iK / rabbitmq.txt
Created July 14, 2017 09:16 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@St0iK
St0iK / gist:72398539de0809c5c64975ce4bede603
Created February 8, 2018 14:26 — forked from arnolanglade/gist:4ca0bedbcf41356a112a
PhpSpec Symfony command template
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class CommandSpec extends ObjectBehavior
{
function it_has_a_name()
{
$this->getName()->shouldReturn('name:command');
}