Skip to content

Instantly share code, notes, and snippets.

View sunpietro's full-sized avatar

sunpietro sunpietro

View GitHub Profile
@sunpietro
sunpietro / CustomBlockExtension.php
Last active July 21, 2016 13:46
CustomBlockExtension.php
<?php
namespace My\BlockBundle\DependencyInjection;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
@sunpietro
sunpietro / CustomBlock.php
Last active July 21, 2016 13:47
CustomBlock.php
<?php
namespace My\BlockBundle\Block;
use EzSystems\LandingPageFieldTypeBundle\Exception\InvalidBlockAttributeException;
use EzSystems\LandingPageFieldTypeBundle\FieldType\LandingPage\Definition\BlockDefinition;
use EzSystems\LandingPageFieldTypeBundle\FieldType\LandingPage\Definition\BlockAttributeDefinition;
use EzSystems\LandingPageFieldTypeBundle\FieldType\LandingPage\Model\AbstractBlockType;
use EzSystems\LandingPageFieldTypeBundle\FieldType\LandingPage\Model\BlockValue;
@sunpietro
sunpietro / custom.html.twig
Created July 20, 2016 11:49
custom.html.twig
<h3>My Custom block</h3>
{{ block }}
@sunpietro
sunpietro / blocks.yml
Created July 20, 2016 11:49
blocks.yml
blocks:
custom:
views:
custom:
template: MyBlockBundle::custom.html.twig
name: My Custom Block view
@sunpietro
sunpietro / CustomBlock.php
Last active July 21, 2016 13:47
Extending eZ Studio with new blocks
<?php
namespace My\BlockBundle\Block;
use EzSystems\LandingPageFieldTypeBundle\Exception\InvalidBlockAttributeException;
use EzSystems\LandingPageFieldTypeBundle\FieldType\LandingPage\Definition\BlockDefinition;
use EzSystems\LandingPageFieldTypeBundle\FieldType\LandingPage\Definition\BlockAttributeDefinition;
use EzSystems\LandingPageFieldTypeBundle\FieldType\LandingPage\Model\AbstractBlockType;
use EzSystems\LandingPageFieldTypeBundle\FieldType\LandingPage\Model\BlockValue;
@sunpietro
sunpietro / calendar.css
Created March 1, 2016 15:07
Simple calendar
* {
margin: 0;
padding: 0;
}
body {
font-family: sans-serif;
color: #333;
}
table {
@sunpietro
sunpietro / string-formatter.js
Last active February 1, 2016 09:31
Formats a string like sprintf
var formatString = (function()
{
var replacer = function(context)
{
return function(s, name)
{
return context[name];
};
};
@sunpietro
sunpietro / fade-in-out.css
Created July 8, 2015 08:19
CSS - fade-in/fade-out transition
.m-fadeOut {
visibility: hidden;
opacity: 0;
transition: visibility 0s linear 300ms, opacity 300ms;
}
.m-fadeIn {
visibility: visible;
opacity: 1;
transition: visibility 0s linear 0s, opacity 300ms;
}
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@sunpietro
sunpietro / index.html
Created January 26, 2015 14:15
How to detect element’s CSS transition end time with JavaScript? - code samples for the article from http://share.ez.no/blogs/piotr-nalepa/how-to-detect-element-s-css-transition-end-time-with-javascript
<div class="container">
<div class="element"></div>
</div>