最近在工作中遇到了一些重复性的任务,为了提升效率,使用了AST进行了批量处理。
ts-morph是一个适用于Javascript、Typescript的AST处理工具库,基于typescript实现。
| type FilterOperator = 'AND' | 'OR'; | |
| type FiltersBy<T> = { | |
| [K in keyof T]?: (value: T[K]) => boolean; | |
| }; | |
| /** | |
| * Factory function that creates a specialized function to filter | |
| * arrays, by validating all filters (AND operator), | |
| * or validating just one of the filters (OR operator). | |
| * @param operator Method to validate all filters: AND, OR |
| 'use strict'; | |
| var gulp = require('gulp'); | |
| var gutil = require('gulp-util'); | |
| var del = require('del'); | |
| var uglify = require('gulp-uglify'); | |
| var gulpif = require('gulp-if'); | |
| var exec = require('child_process').exec; | |
| var notify = require('gulp-notify'); |
| document.getElementsByTagName('button')[0].onclick = function () { | |
| scrollTo(document.body, 0, 1250); | |
| } | |
| function scrollTo(element, to, duration) { | |
| var start = element.scrollTop, | |
| change = to - start, | |
| currentTime = 0, | |
| increment = 20; | |
#/etc/init.d/vboxdrv setup Not Found - VirtualBox Fix!
When setting up Virtual Box I was faced with the immortal error telling me to run sudo /etc/init.d/vboxdrv setup. Simple enough, until you're told it doesn't exist.
Thus began my fight to get it working. The fix is here in the hope that it helps someone else.
To follow this guide you need to have a basic understanding of shell commands. If you don't, then just be careful.
First off I like aptitute so let's install it.