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 / example subrequest
Last active June 29, 2017 22:34
example subrequest
[
{
"requestId": "0",
"uri": "/api/recipes?filter[category.name][value]=Main%20course&page[limit]=4",
"action": "view",
"headers": {
"Accept": "application/json",
"Content-Type": "application/vnd.api+json"
}
},
@yann-yinn
yann-yinn / gist:98d4c9acade0425899da06a9d6dd4000
Created June 29, 2017 22:26
example subrequest response
--8008cc8c5062d2956217bc47b0e08169
Cache-Control: must-revalidate, no-cache, private
Content-Id: <27c656e5c6f170d20649584828a7f7aa>
Content-Language: en
Content-Type: application/vnd.api+json
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Status: 200
X-Content-Type-Options: nosniff
X-Drupal-Cache: HIT
X-Drupal-Dynamic-Cache: MISS
@yann-yinn
yann-yinn / gist:e06cb195a361d97ad4b8f1333ac7e63b
Created June 29, 2017 22:27
example subrequest response
--8008cc8c5062d2956217bc47b0e08169
Cache-Control: must-revalidate, no-cache, private
Content-Id: <27c656e5c6f170d20649584828a7f7aa>
Content-Language: en
Content-Type: application/vnd.api+json
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Status: 200
X-Content-Type-Options: nosniff
X-Drupal-Cache: HIT
X-Drupal-Dynamic-Cache: MISS
@yann-yinn
yann-yinn / nuxtjs-hell-world.vue
Last active July 10, 2017 10:15
NuxtJS hello world
<template>
<h1>Hello world</h1>
</template>
@yann-yinn
yann-yinn / gist:944b2edc3328495cabc9c7b924ae2f0b
Last active July 10, 2017 10:29
tuto-contenta-nuxt-index.vue
<template>
<section class="recipes">
<h1>Our latest recipes</h1>
</section>
</template>
<template>
<div>
<ul>
<li><nuxt-link to="/">home</nuxt-link></li>
<li><nuxt-link to="/hello">Hello World</nuxt-link></li>
</ul>
<nuxt/>
</div>
</template>
@yann-yinn
yann-yinn / gist:8a2d0490fe99d783ba43c64b7b16e54b
Created July 10, 2017 11:31
Nuxt js get recipes from contenta public API with axios
<template>
<section class="recipes">
<h1>Our latest recipes</h1>
<div v-for="recipe in recipes">
<h2> {{recipe.title}} </h2>
<p> {{recipe.difficulty}} </p>
<div v-if="recipe.image">
<img width="300px" :src="recipe.image.thumbnail.filename" />
</div>
</div>
@yann-yinn
yann-yinn / package.json
Created July 12, 2017 10:27
saymyname package
{
"name": "say my name",
"scripts": {
"start": "node index.js"
}
}
@yann-yinn
yann-yinn / Difficulty.spec.js
Last active July 15, 2017 16:35
Example Vue.js unit test : Check our component display "tag is-primary" class when "difficulty" prop is set to "easy"
import Vue from 'vue'
import Difficulty from '~/components/Difficulty'
/**
* An example unit test
*/
describe('Difficulty.vue', () => {
it('Should have class "tag is-primary" when receiving "easy" difficulty', () => {
const Ctor = Vue.extend(Difficulty)
@yann-yinn
yann-yinn / AppNavigation.specs.js
Last active July 31, 2018 18:47
How to unit test a Vue.js / Nuxt.js component that uses <nuxt-link> and store
import Vue from 'vue'
import AppNavigation from '~/components/AppNavigation'
// Mock our router, store and nuxt-link
import Vuex from 'vuex'
import storeCreate from '~/store'
import VueRouter from 'vue-router'
import NuxtLink from '~/.nuxt/components/nuxt-link'
Vue.use(VueRouter)
Vue.use(Vuex)