- Sublime Text下载地址:Download – Sublime Text
- 破解工具“Hex Fiend”下载地址:Hex Fiend, a fast and clever hex editor for macOS
- 打开Hex Fiend -> File ->[……]
分类:其他
处理一直显示npm WARN using –force Recommended protections disabled.的问题
兼容ios11的正则匹配
Windows中Powershell中的 rm -rf 等效命令
sshpass 带密码登陆
shell 删除文件内容Mac、Linux兼容方法
Parsing error: Imports within a `declare module` body must always be `import type` or `import typeof`
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js)
Superset导航栏高亮问题处理
在superset => templates => appbuilder 文件夹下找到 navbar.html 如果没有可对应新建,navbar.html内容如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
{% set menu = appbuilder.menu %} {% set languages = appbuilder.languages %} {% set WARNING_MSG = appbuilder.app.config.get('WARNING_MSG') %} {% set app_icon_width = appbuilder.app.config.get('APP_ICON_WIDTH', 126) %} {% set logo_target_path = appbuilder.app.config.get('LOGO_TARGET_PATH') or '/profile/{}/'.format(current_user.username) %} <div class="navbar navbar-static-top {{ menu.extra_classes }}" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="{{ '/superset' + logo_target_path if current_user.username is defined else '#' }}"> <img width="{{ app_icon_width }}" src="{{ appbuilder.app_icon }}" alt="{{ appbuilder.app_name }}" /> </a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> {% if WARNING_MSG %} <li class="alert alert-danger"> {{ WARNING_MSG | safe }} </li> {% endif %} {% include 'appbuilder/navbar_menu.html' %} </ul> <ul class="nav navbar-nav navbar-right"> {% include 'appbuilder/navbar_right.html' %} </ul> </div> </div> </div> <script> // Highlight the navbar menu const menus = document.querySelectorAll('.nav.navbar-nav li') for (const menu of menus.values()) { const menuParent = menu.parentNode && menu.parentNode.parentNode const parentClasses = menuParent.getAttribute('class') const classes = menu.getAttribute('class') const as = menu.querySelectorAll('a') for (const a of as.values()) { const href = a.getAttribute('href') let path = location.pathname if (path.indexOf(href) > -1) { menu.setAttribute('class', `${classes} active`) if (parentClasses.indexOf('dropdown') > -1) { menuParent.setAttribute('class', `${parentClasses} active`) } else { menuParent.setAttribute('class', `${parentClasses}`) } } else { menu.setAttribute('class', `${classes}`) } } } </script> |
JavaScript设计模式样例二十二 —— 访问者模式
访问者模式(Visitor Pattern)
1 2 3 |
定义:使用一个访问者类,改变元素类的执行算法。通过这种方式,元素的执行算法可以随着访问者改变而改变。 目的:将数据结构与数据操作分离。 场景:您在朋友家做客,您是访问者,朋友接受您的访问,您通过朋友的描述,然后对朋友的描述做出一个判断,这就是访问者模式。 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
// 元素类 class Elements { constructor () { this.action = () => { console.log('hi~') } this.accept = (visitor) => { visitor.visit(this) } } } // 访问者 class Visitor { constructor () { this.visit = (elements) => { elements.action() } } } const ele = new Elements() const visi = new Visitor() ele.accept(visi) |