Skip to content

Instantly share code, notes, and snippets.

class Event {
constructor() {
this.cb = () => {};
}
on(newEvent, cb) {
const oldCb = this.cb;
this.cb = event => {
oldCb(event);
const binpowCount = () => {
let i = 0;
return function binpow (a, b) {
i++
if (b === 1) {
console.log(i)
return a;
}
return b & 1 ? a * binpow(a, b - 1) : binpow(a, b >> 1 ) ** 2
class Dictionary {
constructor() {
this.obj = {};
this.dictionary = {
A: 2,
B: 2,
C: 2,
D: 3,
E: 3,
F: 3,
const sum = (a) => (b) => {
return b !== undefined ? sum(a + b) : a
}
ol {
list-style-type: none;
counter-reset: li;
}
li {
font-size: 2rem;
}
li:before {
counter-increment: li;
import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
Vue.use(VueEvents);
const routes = [
{
name: 'lease_wrap_create',
path: '/lease',
<template>
<ul>
<li v-for="item in levelItems">
{{ item.title }}
<tree :items="items"
:left="item.left"
:right="item.right">
</tree>
</li>
</ul>