Skip to content

Instantly share code, notes, and snippets.

View sunpietro's full-sized avatar

sunpietro sunpietro

View GitHub Profile
@sunpietro
sunpietro / backbone-load-template.js
Last active February 10, 2016 06:01
Backbone.js template loader with caching
var loadTemplate = function (templateFilePath, templateData) {
//console.info('Loading: ' + templateFilePath + ' with data:', templateData);
if (!APP.cache.templates[templateFilePath]) {
var templateDir = 'js/app/template/';
var templateUrl = templateDir + templateFilePath + '.js';
var templateString = '';
$.ajax({
async : false,
@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 / 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 / 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 / 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 / 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 / remove_git_tag
Created November 6, 2017 14:05 — forked from dearaujoj/remove_git_tag
git remove tag locally and remote
git tag -d TagName && git push origin :refs/tags/TagName
@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;
}