Skip to content

Instantly share code, notes, and snippets.

Avatar

Michaël Gallego bakura10

  • Sapporo, Japan
View GitHub Profile
View foo.php
<?php
public function getValidationGroupSpecification()
{
if ($this->authorizationService->hasRole('admin')) {
$fields[] = 'password';
}
return [
'put' => ['first_name', 'last_name'] + $fields,
View text.php
<?php
$routes = [];
if ($_SERVER['ENV'] === 'production') {
$routes = [
'base-connect' => ['hostname' => 'connect.mysite.com', 'secure' => true]
];
} else {
$routes = [
View submit-button.js
'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
View file.php
class UnderscoreNamingStrategy implements NamingStrategyInterface
{
/**
* {@inheritDoc}
*/
public function getNameForExtraction($name, $context = null)
{
return ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $name)), '_');
}
View test.php
<?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
View foo.php
class UserService
{
public function __construct(ObjectManager $manager, UserRepository $repo, EmailService $email, PaymentService $payment, SmsService $sms)
{
//
}
public function register(User $user)
{
$manager->persist($user);
View index.php
<?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]);
}
View test.php
class UserInputFilterFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $service)
{
$factory = // Get from SL;
$inputCollection = new InputCollection('user');
$input = $factory->createInput([
'name' => 'foo',
'validators' => []
View deploy.php
<?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 = '';
View media-queries.scss
// ------------------------
// Organization n°1: put all the media queries at the end of the stylesheet
// ------------------------
.rule1 {
width: 100%;
h1 {
color: red;
}
You can’t perform that action at this time.