Skip to content

Instantly share code, notes, and snippets.

View bakura10's full-sized avatar

Michaël Gallego bakura10

View GitHub Profile
<!-- Let's say we have a "block" that displays a product's title and price: -->
<div class="product-meta">
<h2 class="product-meta__title">Foo</h2>
<p class="product-meta__price">Price</h2>
</div>
<!-- This block has specific styling on a given page. There are other pages when this block is actually included
inside another block. Most styles will be the same, but with very little variations.-->
<header class="header" role="banner">
<div class="header__wrapper">
<!-- Le plus "logique" serait "header__item__sidebar-toggle" mais c'est trop lourd. J'ai aussi pensé à créer un
nouveau "contexte" et faire header-item__sidebar-toggle mais je trouvais ça illogique d'avoir header__item et header-item
sur le même élément !-->
<div class="header__item header__item__sidebar-toggle">
<a href="#"></a>
</div>
</div>
</header>
private function convertToZfResponse(ResponseInterface $response)
{
$zfResponse = new HttpResponse();
$zfResponse->setStatusCode($response->getStatusCode());
$zfResponse->setReasonPhrase($response->getReasonPhrase());
$zfResponse->setContent((string) $response->getBody());
foreach ($response->getHeaders() as $name => $values) {
$zfResponse->getHeaders()->addHeaderLine($name, implode(", ", $values));
.new-products {
background-color: $index-newest-products-background;
.product-list {
.grid-item {
@include grid($index-newest-products-items-per-row, $index-newest-products-horizontal-gutter, $index-newest-products-vertical-gutter);
}
}
.index-section-title {
.newest-products {
.products-list {
.grid-item {
@include grid($home-items-per-row, $home-horizontal-gutter, $home-vertical-gutter);
}
}
.price {
color: red; // Ceci ne s'applique que pour le .price contenu dans .newest-products
}
.collection,
.search {
.products-list {
.grid-item {
@include grid($collection-items-per-row, $collection-horizontal-gutter, $collection-vertical-gutter);
}
}
}
.products-list {
<?php
class UserRegistrationService
{
private $em;
private $service1;
private $service2;
<?php
class UserController
{
/**
* @var EntityManagerInterface
*/
private $entityManager;
public function create()
<?php
class Foo
{
public function myMethod()
{
$myData = [];
// MyData is filled with approximately 50-500 elements, but with a lot of attributes inside each element.
// BUT one of the property inside each element is an iterator. Therefore each element looks a bit like this:
// ------------------------
// Organization n°1: put all the media queries at the end of the stylesheet
// ------------------------
.rule1 {
width: 100%;
h1 {
color: red;
}