Skip to content

Instantly share code, notes, and snippets.

View sunpietro's full-sized avatar

sunpietro sunpietro

View GitHub Profile
@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;
}
@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 / calendar.css
Created March 1, 2016 15:07
Simple calendar
* {
margin: 0;
padding: 0;
}
body {
font-family: sans-serif;
color: #333;
}
table {
@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 / 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 / custom.html.twig
Created July 20, 2016 11:49
custom.html.twig
<h3>My Custom block</h3>
{{ block }}
@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 / 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 / services.yml
Created July 20, 2016 11:52
services.yml
services:
my.block.custom:
class: My\BlockBundle\Block\CustomBlock
tags:
- { name: landing_page_field_type.block_type, alias: custom }
@sunpietro
sunpietro / countries.json
Created April 2, 2017 19:01
List of countries with 2-letter and 3-letter country codes
[
{"name":"Afghanistan","let2":" AF","let3":"AFG"},
{"name":"Albania","let2":"AL","let3":"ALB"},
{"name":"Algeria","let2":"DZ","let3":"DZA"},
{"name":"American Samoa","let2":"AS","let3":"ASM"},
{"name":"Andorra","let2":"AD","let3":"AND"},
{"name":"Angola","let2":"AO","let3":"AGO"},
{"name":"Anguilla","let2":"AI","let3":"AIA"},
{"name":"Antigua and Barbuda","let2":"AG","let3":"ATG"},
{"name":"Argentina","let2":"AR","let3":"ARG"},