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 / app.css
Created August 14, 2017 11:19
Page transitions slide effect example with Nuxt.js and Vue.js
// only for desktop for now,
@media screen and (min-width: 1008px) {
/* during entering and leaving : */
.page-enter-active, .page-leave-active {
position:absolute;
max-width:725.328px; /*make sur our content keep it's original width*/
transition: all .2s ease;
}
@yann-yinn
yann-yinn / contact.vue
Created August 14, 2017 11:34
adding transition for pages with Nuxt.js
<template>
<Contact />
</template>
<script>
import Contact from '~/components/Contact'
export default {
transition: 'page', // set our transition with nuxt.js
components: { Contact },
}
@yann-yinn
yann-yinn / api.js
Created August 23, 2017 13:01
Using cachios with Nuxt.js and express
/**
* Get content from wordpress via REST Api
*/
const config = require('../nuxt.config.js')
const axios = require('axios')
// always call the proxy here :
const endpoint = config.env.proxyApiBaseUrl
/**
* @param {int} perPage : number of post to return per page
@yann-yinn
yann-yinn / store.js
Created September 3, 2017 09:08
Vuex.Store with modules
new Vuex.Store({
state: { counter: 0 },
mutations: {
increment (state) {
state.counter++
}
},
modules: {
todos: {
state: {
@yann-yinn
yann-yinn / Index.vue
Created October 2, 2017 16:26
Drupal experiment with Nuxt.js : get route informations by Drupal before determing with Component should be used
<template>
<div>
<component :is="currentComponent" :componentData="componentData" />
<div id="route-debug">
<pre>{{route}}</pre>
</div>
</div>
</template>
<script>
@yann-yinn
yann-yinn / preferences.json
Last active October 25, 2017 21:05
Enable Emmet in jsx files with VSCODE 1.7
// add this line to your preferences
"emmet.includeLanguages": { "javascript": "javascriptreact" }
@yann-yinn
yann-yinn / index.js
Created November 3, 2017 16:48
get url GET params from nuxt.js asyncData method
// destructuring
async asyncData({ route }) {
console.log(route);
}
// without destructuring
async asyncData(allParams) {
console.log(allParams.route);
}
handleChange = event => {
const target = event.target;
const value = target.type === "checkbox" ? target.checked : target.value;
const name = target.name;
this.setState({
[name]: value
});
};
@yann-yinn
yann-yinn / file.sh
Last active December 3, 2017 11:46
# lister les interfaces écoutables
tcpdump --list-interfaces
# écouter une interface "en0"
tcpdump -i en0
# écouter le traffic entrant ou sortant d'une IP en particulier
tcpdump host 1.2.3.4
tcpdump src 2.3.4.5
tcpdump dst 3.4.5.6
tcpdump port 80
@yann-yinn
yann-yinn / example.html
Created January 23, 2018 09:06
Flex : center element vertically and horizontally
<!--
On the parent div :
display:flex
align-items: center;
justify-content: center;
-->
<div style="background: silver; height: 100vh; display:flex; align-items: center;justify-content: center;" class="container">
<div style="background: yellow; height: 20vh">Center me please</div>
</div>