This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.slugify = function (separator = '-') { | |
| return this.toString() | |
| .normalize('NFD') | |
| .replace(/[\u0300-\u036f]/g, '') | |
| .toLowerCase() | |
| .trim() | |
| .replace(/[^a-z0-9 ]/g, '') | |
| .replace(/\s+/g, separator) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const countries = [ | |
| "Afghanistan", | |
| "Albania", | |
| "Algeria", | |
| "Andorra", | |
| "Angola", | |
| "Antigua and Barbuda", | |
| "Argentina", | |
| "Armenia", | |
| "Australia", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div class="editor"> | |
| <template v-if="editor && !loading"> | |
| <div class="count"> | |
| {{ count }} {{ count === 1 ? 'user' : 'users' }} connected to {{ projectPath }}/{{ docName }} | |
| </div> | |
| <editor-content class="editor__content" :editor="editor" /> | |
| </template> | |
| <em v-else> | |
| Connecting to socket server … |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # config.js | |
| const config = { | |
| ..., | |
| features: { | |
| ... | |
| }. | |
| ... | |
| } | |
| function feature (name) { | |
| return config.features[name] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ---------------------------------------------------------------------- | |
| # {TYPE}: [{SCOPE}] {SUBJECT} What? | |
| # {BODY} Why? | |
| # {FOOTER} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A script that can pull down the result of the introspection query | |
| // from a running graphql server. | |
| // Dependencies: | |
| // npm i -S isomorphic-fetch graphql-tag graphql apollo-client | |
| // Usage: | |
| // node fetch-graphql-schema [graphql url] | |
| // Example: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function* rateLimit(limit, time) { | |
| let count = 0; | |
| while(true) { | |
| if(count++ >= limit) { | |
| await delay(time); | |
| count = 0; | |
| } | |
| yield; // Let's execute next code | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Vue from 'vue' | |
| import forEach from 'lodash/forEach' | |
| const icons = require.context('~/icons', false, /[A-Z]\w+\.(svg)$/) | |
| forEach(icons.keys(), (fileName) => { | |
| const iconConfig = icons(fileName) | |
| const iconName = fileName.split('/').pop().split('.')[0] | |
| Vue.component(iconName, iconConfig.default || iconConfig) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Remove edges, node and __typename from graphql response | |
| * | |
| * @param {Object} input - The graphql response | |
| * @returns {Object} Clean graphql response | |
| */ | |
| const cleanGraphQLResponse = function(input) { | |
| if (!input) return null | |
| const output = {} | |
| const isObject = obj => { |
