Skip to content

Instantly share code, notes, and snippets.

Avatar

Michaël Gallego bakura10

  • Sapporo, Japan
View GitHub Profile
View gist:fedc9c743f3757aeafe5
<!-- 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.-->
View gist:98b0b8014bcc980315cc
<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>
View gist:361c80543dc2bea24035
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));
View gist:8114f4e6a8384778ffc0
.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 {
View bar.scss
.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
}
View foo.scss
.collection,
.search {
.products-list {
.grid-item {
@include grid($collection-items-per-row, $collection-horizontal-gutter, $collection-vertical-gutter);
}
}
}
.products-list {
View aggregateService
<?php
class UserRegistrationService
{
private $em;
private $service1;
private $service2;
View foo.php
<?php
class UserController
{
/**
* @var EntityManagerInterface
*/
private $entityManager;
public function create()
View test.php
<?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:
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.