Skip to content

Instantly share code, notes, and snippets.

View bakura10's full-sized avatar

Michaël Gallego bakura10

View GitHub Profile
<?php
public function getValidationGroupSpecification()
{
if ($this->authorizationService->hasRole('admin')) {
$fields[] = 'password';
}
return [
'put' => ['first_name', 'last_name'] + $fields,
<?php
$routes = [];
if ($_SERVER['ENV'] === 'production') {
$routes = [
'base-connect' => ['hostname' => 'connect.mysite.com', 'secure' => true]
];
} else {
$routes = [
'use strict';
/**
* This component allows to have a three-state button, that is useful when saving. Basically,
* when the state "isSaving" changed to true, the class "is-saving" is added. When the isSaving goes
* back to false, a class "saved" is added during 2 seconds to give feedback to the user
*/
module.exports = App.SubmitButtonComponent = Ember.Component.extend({
/**
* We completely disable tagname as we don't want it to be wrap
class UnderscoreNamingStrategy implements NamingStrategyInterface
{
/**
* {@inheritDoc}
*/
public function getNameForExtraction($name, $context = null)
{
return ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $name)), '_');
}
<?php
// ListenerAggregateInterface would change, and it would have... a static method (yeah yeah):
class UserListenerAggregate implements ListenerAggregateInterface
{
static function getListenersConfiguration()
{
// This would be a standardized configuration
class UserService
{
public function __construct(ObjectManager $manager, UserRepository $repo, EmailService $email, PaymentService $payment, SmsService $sms)
{
//
}
public function register(User $user)
{
$manager->persist($user);
<?php
class MyInputFilter extends InputFilter
{
public function __construct()
{
$this->add(['name' => 'example', 'required' => false]);
$this->add(['name' => 'foo', 'required' => false]);
$this->add(['name' => 'bar', 'required' => false]);
}
class UserInputFilterFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $service)
{
$factory = // Get from SL;
$inputCollection = new InputCollection('user');
$input = $factory->createInput([
'name' => 'foo',
'validators' => []
<?php
use Aws\Common\Aws;
const AWS_ACCESS_KEY = '';
const AWS_SECRET_KEY = '';
const AWS_REGION = 'us-east-1';
const S3_BUCKET = '';
const EB_APPLICATION_NAME = '';
// ------------------------
// Organization n°1: put all the media queries at the end of the stylesheet
// ------------------------
.rule1 {
width: 100%;
h1 {
color: red;
}