Skip to content

Instantly share code, notes, and snippets.

View yann-yinn's full-sized avatar

Yann yann-yinn

  • Yann
  • France, Nantes
View GitHub Profile
@yann-yinn
yann-yinn / api.graphql
Last active September 3, 2020 13:06
api.graphql
# Draft API technique :
# calqué sur mongoDB: il y a toujours une clef libre "filter" et "sort"
# Pour éviter de créer des méthodes de type postById, postBySlug, postBy{fieldName}
#
# récupérer une liste de post pour un blog particulier
#
{
posts(
first: 50
@yann-yinn
yann-yinn / disqus-example.html
Last active October 30, 2020 22:00
Disqus example
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "{{process.env.SITE_URL + page.url}}"; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = "{{process.env.SITE_URL + page.url}}"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://{{process.env.DOMAIN}}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
@yann-yinn
yann-yinn / example.njk
Created June 23, 2020 10:45
automatic sw cache key on build for eleventy
---
permalink: sw.js
---
'use strict';
const CACHE_VERSION = {{page.date.getTime()}};
const staticCacheName = "version-" + CACHE_VERSION;
const pagesCacheName = 'pages-' + CACHE_VERSION;
const { ApolloServer, gql } = require('apollo-server');
// une fausse base de données avec 2 users
const users = [
{
id:1,
name: 'Yann',
email: 'yann@mail.com',
},
{
var AWS = require("aws-sdk");
var credentials = {
accessKeyId: process.env.AWS_ACCESS_KEY,
secretAccessKey: process.env.AWS_SECRET_KEY
};
AWS.config.update({
credentials: credentials,
region: process.env.AWS_S3_REGION
});
@yann-yinn
yann-yinn / example-blog.js
Last active November 4, 2019 07:14
example-blog.js
// donne moi l'article 44 du blog numéro 789789689
const post = api.get("https://api.fireblogcms.com/blog/789789689/posts/44")
// affichage de l'article 44
<div>
{{post.title}}
{{post.content}}
</div>
@yann-yinn
yann-yinn / index.js
Created September 30, 2019 09:31
iframely render text with oembed tags in a theme
document.querySelectorAll("oembed[url]").forEach(element => {
iframely.load(element, element.attributes.url.value);
});
@yann-yinn
yann-yinn / i18nmodel.js
Created August 30, 2019 09:26
i18nmodel.json
# TAGS
tags: {
_id: "abc"
name: {
"Fr-fr": "Bonjour",
"En-uk": "Hello"
}
description: {
"Fr-fr": "description",
@yann-yinn
yann-yinn / ckeditor-code.html
Created July 25, 2019 13:52
ckeditor-code.html
<figure>
<figcaption>Your code title</figcaption>
<pre>
<code contenteditable spellcheck="false">
<!-- your code here -->
</code>
</pre>
</figure>
@yann-yinn
yann-yinn / example.html
Created April 4, 2019 15:16
vue-ckeditor sample
<script>
import CKEditor from "@ckeditor/ckeditor5-vue";
// import Editor from "@ckeditor/ckeditor5-build-classic";
// import Editor from "@ckeditor/ckeditor5-build-balloon";
import Editor from "@ckeditor/ckeditor5-build-balloon-block";
export default {
components: {
// Use the <ckeditor> component in this view.
ckeditor: CKEditor.component