Skip to content

Instantly share code, notes, and snippets.

@iNahooNya
iNahooNya / index.js
Created April 23, 2020 02:59
【@antv/g2 - v4】用 Hack AnnotationController 的方式支持 chart.annotation().html()
/**
* @fileOverview
* 兼容用法
* 用 Hack 的方式支持 guide().html();
* @author iNahoo
* @since 2020-04-21.
*/
import { registerComponentController } from '@antv/g2';
import Annotation from '@antv/g2/lib/chart/controller/annotation';
@iNahooNya
iNahooNya / util.js
Last active June 8, 2017 03:47
常用的工具方法
/**
* 以回调函数反馈Key的方式,实现数组去重
* @param a {Array}
* @param key {Function}
*/
function uniqBy(a, key) {
var seen = {};
return a.filter(function(item) {
var k = key(item);
return seen.hasOwnProperty(k) ? false : (seen[k] = true);
@iNahooNya
iNahooNya / easingEffects.js
Created February 22, 2017 02:26
各个缓动函数
var easingEffects = {
linear: function (n) {
return n;
},
easeIn: function (n) {
return pow(n, 1.7);
},
easeOut: function (n) {
return pow(n, 0.48);
},
@iNahooNya
iNahooNya / line.js
Last active March 22, 2017 03:32
代码行数统计
/**
* @fileOverview
* 统计代码行数,
* 适用 JS/HTML/CSS
* @author iNahoo
* @since 2017/3/21.
*/
"use strict";
const FS = require('fs');
@iNahooNya
iNahooNya / bezierCurve.js
Created February 21, 2017 10:44
【二阶贝塞尔曲线】快速计算一组点的平滑曲线控制点 , 用于Canvas绘图
/**
* @fileOverview
* 二阶贝塞尔曲线
* --------------------
* 快速计算一组点的平滑曲线控制点 , 用于Canvas绘图
* @author iNahoo
* @since 2017/2/17.
*/
"use strict";
@iNahooNya
iNahooNya / rgb.js
Created February 21, 2017 09:57
rgb & rgba & hexColor transfer
/**
* @fileOverview
* rgb & rgba & hexColor transfer
* @author iNahoo
* @since 2017/2/10.
*/
"use strict";
export const rgb2hex = (r, g, b)=> {
return '#' + [r, g, b].map(v=>v.toString(16))
@iNahooNya
iNahooNya / vue-event-manager.js
Created February 20, 2017 02:57
vue-event-manager - 兼容supportsPassive
/**
* @fileOverview
* 提供全局的事件绑定
* --------------------------
* 用于解决某些情况下, touchend / touchmove 等事件不应触发在组件内的DOM上的情况
*
* @author iNahoo
* @since 2017/2/13.
*/
"use strict";