Skip to content

Instantly share code, notes, and snippets.

View Teemwu's full-sized avatar
🎯
Focusing

Teemwu Teemwu

🎯
Focusing
View GitHub Profile
@Teemwu
Teemwu / OneNote-to-MD.md
Created March 19, 2020 08:52 — forked from heardk/OneNote-to-MD.md
Convert notes from OneNote into Markdown

Converting One Note to Markdown

This is an example of how to convert notes from OneNote into Markdown to use in other, less annoying Note applications. I am using PowerShell on Windows here, but other shell/scripting environments would work as well. If you want separate .md files, you'll need to export your OneNote pages separately. Exporting a section, or a selection of pages creates a single .docx file.

  • Download and install Pandoc
  • Export each of your note pages to a .docx (Word) format using OneNote export from the File menu
  • Gather all of these .docx files into a directory
  • Open directory in File Explorer
  • Open Powershell from the File Explorer using File -> Open Windows Powersell
  • Run the following command:
@Teemwu
Teemwu / vue.config.js
Last active November 20, 2022 05:36
vue-cli 3.x 打包配置
/* eslint-disable comma-dangle */
/* eslint-disable @typescript-eslint/camelcase */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
// js 压缩
const TerserPlugin = require('terser-webpack-plugin')
// gzip 生成
const CompressionWebpackPlugin = require('compression-webpack-plugin')
// cdn 支持
const CDNPlugin = require('webpack-cdn-plugin')
@Teemwu
Teemwu / formatter.dart
Last active July 19, 2022 16:19
Dart utils
class Format {
/// 将数字转换成 'k' 结尾的字符串
/// https://stackoverflow.com/a/9462382
static nFormatter(dynamic num, [int digits=1]) {
var si = [
{'value': 1, 'symbol': ''},
{'value': 1e3, 'symbol': 'k'},
{'value': 1e6, 'symbol': 'M'},
{'value': 1e9, 'symbol': 'G'},
{'value': 1e12, 'symbol': 'T'},
@Teemwu
Teemwu / css3_cube.markdown
Last active April 19, 2020 02:39
css3_cube
@Teemwu
Teemwu / _apply.js
Last active September 14, 2021 03:15
手写 apply、call、bind 方法
'use strict';
/**
* 手写 apply 方法
* @param {*} context 上下文 this
* @returns 指定的 this 值和参数
*/
Function.prototype._apply = function (context) {
// 判断上下文 context 是否存在
// 不存在则指向 window
@Teemwu
Teemwu / _setInterval.js
Last active September 14, 2021 10:06
setTimeout 模拟实现 setInterval
'use strict';
/**
* 使用 setTimeout 模拟 setInterval
* @param {Function|string} handler 要执行的函数或者要执行的函数字符串
* @param {number} delay 时间间隔
*/
window._setInterval = function (handler, delay) {
// 判断第二个参数是否为字符串
const isFunc = typeof handler === 'string'
// 获取第二个参数后的其它参数
@Teemwu
Teemwu / _render.js
Last active September 15, 2021 01:51
虚拟 DOM 转真实 DOM
'use strict';
const astObj = {
tag: 'DIV',
attrs: {
id: 'app'
},
children: [
{
tag: 'SPAN',
@Teemwu
Teemwu / _all.js
Last active September 15, 2021 07:40
手写 Promise.all 和 Promise.race
'use strict';
/**
* 手写实现 Promise.all 方法
* @param {string|array} values 一个可迭代对象
* @returns promise
*/
Promise._all = (values) => {
// 判断是否为可迭代对象
if (!values.hasOwnProperty('length')) {
throw new Error(`TypeError: ${typeof values} is not iterable`);
@Teemwu
Teemwu / _new.js
Last active September 16, 2021 04:14
手写 new 操作符
'use strict';
/**
* 手写 new 操作符
* 注:暂不支持 Class 传入
* @param {*} fn 函数
* @param {...any} args 其它参数
* @returns function
*/
function _new(fn, ...args) {
// 创建拥有 fn 原型的对象
@Teemwu
Teemwu / polling.ts
Last active December 30, 2021 07:03
封装各种轮询
export default class Polling {
private timer: number
private interval: number
private times: number
constructor(interval = 5e3, times = -1) {
this.interval = interval
this.times = times