Skip to content

Instantly share code, notes, and snippets.

View Didier-Vaerman's full-sized avatar

Tilt Factory Didier-Vaerman

View GitHub Profile
@Didier-Vaerman
Didier-Vaerman / menu.inc
Last active January 22, 2018 16:37
Add icon to menu links
<?php
/**
* @file
* Theme and preprocess functions for menu.
*/
/**
* Implements hook_theme_menu_alter().
*/
@Didier-Vaerman
Didier-Vaerman / signature.html
Created December 22, 2016 15:02
Signature Mail
<table cellpadding="0" cellspacing="0" border="0" style="background: none; border-width: 0px; border: 0px; margin: 0; padding: 0;">
<tr>
<td valign="top" style="max-width: 201px; padding-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 7px; border-top: 0; border-bottom: 0; border-left: 0; border-right: 0;">
<img style="width: 100%; height: auto;" id="preview-image-url" src="https://dl.dropboxusercontent.com/u/5358851/signature_tilt.jpg">
</td>
<td style="padding-top: 0; padding-bottom: 0; padding-left: 12px; padding-right: 0;">
<table cellpadding="0" cellspacing="0" border="0" style="background: none; border-width: 0px; border: 0px; margin: 0; padding: 0;">
<tr>
<td colspan="2" style="padding-bottom: 5px; color: #000; font-size: 16px; font-family: Arial, Helvetica, sans-serif; font-weight:bold;">
Baptiste Marck
---
# `vagrant_box` can also be set to geerlingguy/centos6, geerlingguy/centos7,
# geerlingguy/ubuntu1204, parallels/ubuntu-14.04, etc.
vagrant_box: geerlingguy/ubuntu1404
vagrant_user: vagrant
vagrant_synced_folder_default_type: nfs
# If you need to run multiple instances of Drupal VM, set a unique hostname,
# machine name, and IP address for each instance.
vagrant_hostname: drupalvm.dev
@Didier-Vaerman
Didier-Vaerman / bouncingMatrix.js
Last active July 1, 2016 14:37
Animate 3d object to origin with bounce effect
function bouncingValue(elem) {
var matrix = elem.css('transform');
var results = matrix.split('(')[1].split(')')[0].split(',');
$({
a: results[0],
b: results[1],
c: results[2],
d: results[3],
e: results[4],
f: results[5],
@Didier-Vaerman
Didier-Vaerman / navigation.js
Created May 12, 2016 14:57
If element is in view, get href from link then substrat href before hash to find the link to add active class + Scroll to anchor
function scrollToAnchor(aid){
var aTag = $("a[name='"+ aid +"']");
$('html,body').animate({scrollTop: aTag.parents().offset().top - 100},'slow');
}
var sections = $('.content-section')
, nav = $('.page-navigation')
, navLink = nav.find('a').attr('href')
, navHash = navLink.substr(0,navLink.indexOf('#'))
, nav_height = nav.outerHeight();
$( window ).scroll(function(){
$('.banner-image[data-perspective]').each(function(){
var perspective = $(this).data('perspective');
var position = $(this).parents().position();
var scrollTop = position.top - $(window).scrollTop();
var height = $(this).outerHeight();
var calc = $(this).outerHeight() - height - scrollTop ;
$(this).css({'transform': 'translate3d(0px, ' + Math.round(calc/perspective) + 'px, 0px)'});
});
});
@Didier-Vaerman
Didier-Vaerman / html.html.twig
Created April 8, 2016 10:20
Add class to body
{%
set body_classes = [
logged_in ? 'user-logged-in',
not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class,
node_type ? 'page-node-type-' ~ node_type|clean_class,
db_offline ? 'db-offline',
]
%}
<body{{ attributes.addClass(body_classes) }}>
<?php
/**
* @file
* Contains \Drupal\tilt_display\Plugin\Block\LocationBlock.
*/
namespace Drupal\tilt_display\Plugin\Block;
use Drupal\Core\Block\BlockBase;