Skip to content

Instantly share code, notes, and snippets.

Ismayil Khayredinov hypeJunction

Block or report user

Report or block hypeJunction

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View codemirror.js
import codemirror from 'vue-codemirror/src/codemirror.vue';
export default (config) => {
if (config) {
if (config.options) {
codemirror.props.globalOptions.default = () => config.options;
}
if (config.events) {
codemirror.props.globalEvents.default = () => config.events;
}
View enhanceApp.js
export default (
{
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData, // site metadata
},
) => {
Vue.component('codemirror', async () => {
// This module will export a function configuring codemirror component
View ComponentDemo.vue
<template>
<n-module type="demo">
<div slot="header" class="demo">
<component :is="`demos-${name}`"/>
</div>
<div class="code">
<codemirror :value="raw" :options="cmOptions"></codemirror>
</div>
</n-module>
View ComponentMeta.vue
<template>
<div class="component-meta">
<n-box v-if="meta.description">{{ meta.description }}</n-box>
<n-module type="demo" class="component-meta">
<div slot="header"></div>
<n-tabs :items="tabs">
<component-props slot="props" :data="meta.props"></component-props>
<component-slots slot="slots" :data="meta.slots"></component-slots>
<component-events slot="events" :data="meta.events"></component-events>
View docs.json
[{
"name": "Button",
"description": null,
"keywords": [],
"slots": [
{
"kind": "slot",
"visibility": "public",
"description": "",
"keywords": [],
View parser.js
const vuedoc = require('@vuedoc/parser');
const config = require('../../src/noah.config');
const fs = require('fs');
const path = require('path');
const jobs = Object.keys(config.components).map((name) => {
const component = config.components[name];
const componentPath = component.path ? path.resolve(__dirname, '../../src/', component.path) : '../../src/elements';
return vuedoc.parse({ filename: path.resolve(__dirname, `${componentPath}/${name}.vue`) });
View App.js
export default class App {
constructor (services) {
this.services = services;
}
start () {
const { express, db } = this.services;
if (!db.models) {
db.loadModels(this.services);
View DatabaseConnection.js
import { inspect } from 'util';
import Sequelize from 'sequelize';
export default function DatabaseConnection (config, logger) {
const {
dialect,
name,
host,
port,
user,
View UserModel.js
import BaseModel from '../db/BaseModel';
export default class User extends BaseModel {
static registerHooks () {
this.beforeSave((user) => {
if (user.changed('password') && user.password) {
if (user.password.substr(0, 7) === 'bcrypt$') {
throw new Error('Do not bcrypt passwords before setting them');
}
View schema2.js
{
User: {
// You can use an import or require
class: require('../models/User').default,
options: {
tableName: 'users',
createdAt: 'date_joined',
updatedAt: 'date_updated',
},
attributes: {
You can’t perform that action at this time.