Skip to content

Instantly share code, notes, and snippets.

View Akryum's full-sized avatar
☮️
Meow

Guillaume Chau Akryum

☮️
Meow
View GitHub Profile
@Akryum
Akryum / backend.js
Last active January 6, 2018 14:08
Vue devtools CustomValue API
const sendThisToDevtools = {
_custom: {
type: 'set',
display: 'Set[3]',
readOnly: true,
value: [1, 2, {
_custom: {
type: 'map',
display: 'Map[3]',
value: { a: 42, b: 'foo' }
@Akryum
Akryum / example.js
Created October 14, 2017 15:06
Scoped slots + Apollo
Vue.component('SomeData', {
apollo: {
items: ITEMS_QUERY,
},
template: `
<div>
<slot :items="items"/>
</div>
`,
})
@Akryum
Akryum / README.md
Last active September 18, 2017 15:15 — forked from patrick-steele-idem/README.md
Syntax: Marko vs Vue

Syntax: Marko vs Vue

Custom tags and passing data

Marko:

<greeting
  name=fullName
 message-count=30
@Akryum
Akryum / index.html
Created May 4, 2017 16:49
Mobile Browser color
<meta name="theme-color" content="#00aaff"/>
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="#00aaff"/>
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
@Akryum
Akryum / Demo.vue
Last active February 25, 2019 16:18
vue-responsive
<template>
<div>
<div v-if="$responsive.mobile">Mobile</div>
<div v-else-if="$responsive.tablet">Tablet</div>
<div v-else>Desktop</div>
</div>
</template>
const field = this._leaving ? 'leave' : 'enter'
const lastField = '_lastDuration_' + field
const duration = this.duration
const explicitDuration = parseDuration((
duration !== null &&
typeof duration === 'object' &&
duration[field]
) || duration)
const el = child.elm
@Akryum
Akryum / subscriptions.js
Created November 1, 2016 14:46
GraphQL server subscriptions
import { PubSub, SubscriptionManager } from 'graphql-subscriptions';
import schema from './schema';
const pubsub = new PubSub();
const subscriptionManager = new SubscriptionManager({
schema,
pubsub,
setupFunctions: {
tagAdded: (options, args) => {
console.log(args);
@Akryum
Akryum / PostList.vue
Last active November 1, 2016 12:32
Initialize data
// Local state
data: () => ({
// You can initialize the 'posts' data here
posts: [],
loading: 0,
}),
@Akryum
Akryum / PostUpvoter.vue
Created September 22, 2016 08:21
Apollo mutation example in a Vue component
<script>
import gql from 'graphql-tag';
// GraphQL Mutation with one parameter
const upvoteMutation = gql`
mutation upvotePost($postId: Int!) {
upvotePost(postId: $postId) {
id
votes
}
@Akryum
Akryum / App.vue
Last active September 21, 2016 18:45
<script>
export default {
created() {
this.$apollo.watchQuery({
/* options */
}).then(data => {
console.log(data);
});
},
};