Skip to content

Instantly share code, notes, and snippets.

View davision's full-sized avatar
:octocat:
Vuetifying the web.

David Licen davision

:octocat:
Vuetifying the web.
View GitHub Profile
@davision
davision / nuxt-js-and-gsheet-example.vue
Created June 8, 2018 11:27 — forked from yann-yinn/nuxt-js-and-gsheet-example.vue
Nuxt.js vue component to display datas from a google spreadsheet (with google api V4 without oAuth )
<template>
<div id="homepage">
<h1>Les dernières Articles</h1>
<div class="article" v-for="article in articles">
<h2> {{ article.title }} </h2>
<p> {{ article.content }} </p>
</div>
</div>
</template>
@davision
davision / menu--main.html.twig
Last active August 8, 2020 10:50
Custom Drupal main menu which detects Log in link an adds class to it
{% macro menu_links(items, attributes, menu_level) %}
{% import _self as menus %}
{% if items %}
{% if menu_level == 0 %}
<ul{{ attributes.addClass('menu') }}>
{% else %}
<ul class="menu">
{% endif %}
{% for item in items %}
{%
@davision
davision / _spacing-helper.scss
Last active August 8, 2020 10:53 — forked from kieranmv95/_spacing-helper.scss
Generates a array of spacing helper classes for margin and padding
// Customisable spacing units. these can be changed and new ones added
$spacing-units: (
1: 1rem,
2: 2rem,
3: 3rem,
4: 4rem,
5: 5rem,
6: 6rem,
);
@davision
davision / hamburger-menu.scss
Last active August 8, 2020 10:54
Simple animated mobile hamburger menu
#hamburger {
color: white;
font-size: 2rem;
width: inherit;
z-index: 501;
.line {
width: 30px;
height: 4px;
background-color: #ecf0f1;
@davision
davision / transition-component.vue
Created March 5, 2018 14:06
Encapsulated wrapper transition component
<template>
<transition name="fade" v-bind="$attrs" v-on="$listeners">
<slot></slot>
</transition>
</template>
<script>
export default {};
</script>
<style>
.fade-enter-active,
@davision
davision / youtube_id_regex.php
Created March 2, 2018 15:43 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@davision
davision / theme_preprocess.php
Last active December 15, 2021 00:21
How to get URL from Media entity field inside a paragraph in Drupal 8
<?php
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Url;
use Drupal\media\Entity\Media;
use Drupal\Core\Site\Settings;
use Drupal\file\Entity\File;
/**
* Preprocess functions for background iamge in Tagline paragraph
@davision
davision / vue2-countdown.vue
Last active May 3, 2024 13:22
Simple countdown component for VueJS 2
<template lang="html">
<div v-if="isEnded">
Ended.
</div>
<div v-else>
<div>Days: {{ days }}</div>
<div>Hours: {{ hours }}</div>
<div>Minutes: {{ minutes }}</div>
<div>Seconds: {{ seconds }}</div>

Keybase proof

I hereby claim:

  • I am davision on github.
  • I am davision (https://keybase.io/davision) on keybase.
  • I have a public key whose fingerprint is 9380 7945 570E 89EF F9E3 F200 34E9 47FF D856 5451

To claim this, I am signing this object: