Skip to content

Instantly share code, notes, and snippets.

import { createElement } from '@vue/composition-api'
import htm from 'htm'
const acceptValue = ['input', 'textarea', 'option', 'select']
function getVNodeData (tag, attrs) {
const data = {}
const basics = ['slot', 'key', 'ref', 'refInFor', 'class', 'style']
const components = {
'*': 'strong',
'_': 'em',
'~': 's',
'```': 'code'
}
export default {
functional: true,
props: {
function KonamiCodeMixin (callback) {
const KEYS = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'KeyB', 'KeyA']
let i = 0
return {
mounted () {
window.addEventListener('keyup', this.onKeyUp)
},
destroyed () {
window.removeEventListener('keyup', this.onKeyUp)
[
[
"gbdmg",
[
[
42,
69,
59
],
[
module.exports = {
name: 'StarRating',
functional: true,
props: {
stars: {
type: Number,
default: 0
},
tag: {
type: String,
(function() {
let props = $$('*')
.filter(x => Object.keys(x.dataset).length)
.reduce((o,x) => {
Object.keys(x.dataset).forEach(key => {
o[key] = key.replace(/[A-Z]/g, y => '-' + y.toLowerCase());
});
return o;
}, {});
var Promise = require('bluebird');
var fs = require('fs');
var noop = function(){};
var DEFAULT_TIMEOUT = 60 * 2 * 1000;
module.exports = function watch(fileName, until, timeout) {
var watcher;
if (typeof until !== 'function') until = noop;
timeout = Number(timeout) || DEFAULT_TIMEOUT;
var exec = require('child_process').exec;
var rForbidden = /(["'#&;`\|\*\?~<>\^\(\)\[\]\{\}\$\\\x0A\xFF])/g;
var isWindows = process.platform === 'win32';
module.exports = function(cmd, options, callback) {
cmd = cmd.replace(rForbidden, isWindows ? '^$1': '\\$1');
return exec(cmd, options, callback);
};
function create(proto, obj) {
var descriptor = {};
Object.keys(Object(obj)).forEach(function(prop) {
descriptor[prop] = Object.getOwnPropertyDescriptor(obj, prop);
});
return Object.create(proto || null, descriptor);
}