Skip to content

Instantly share code, notes, and snippets.

View Alex-xd's full-sized avatar

Alex Alex-xd

View GitHub Profile
function debounce(dom, event, fn, timeout) {
var timeout = timeout || 3; // 默认延迟3s内点击无效
var timer = null;
// cornor cases
if (!dom || !event || !(event in dom) || typeof fn !== 'function') {
return
}
dom.addEventListener(event, function () {
var _this = this;
$(document.links).filter(function() {
return this.hostname != window.location.hostname;
}).attr('target', '_blank');
@Alex-xd
Alex-xd / 1.js
Created September 13, 2016 05:01
找出下面代码的规律并且编写一个函数,转换特定的整数到对应的字符串。 1 => A,2 => B,3 => C,...,26 => Z,27 => AA,28 => AB,29 => AC,...,52 => AZ,53 => BA,...
function convert(num){
var result = ""
while(num){
result = String.fromCharCode( --num % 26 + 65) + result
num = Math.floor(num / 26)
}
return result
}
@Alex-xd
Alex-xd / oo.js
Created September 10, 2016 02:51
一段代码解释JavaScript面向对象
作者:颜海镜
链接:https://zhuanlan.zhihu.com/p/22388052
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
(function(){
//私有静态成员
var user = "";
//私有静态方法
@52cik
52cik / npm.taobao.sh
Last active February 29, 2024 02:56
npm 淘宝镜像配置
npm set registry https://r.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set ELECTRON_MIRROR https://cdn.npm.taobao.org/dist/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
@Turbo87
Turbo87 / app.js
Created February 15, 2015 04:05
webpack + font-awesome test
require('font-awesome/css/font-awesome.css');
document.body.innerHTML = '<i class="fa fa-fw fa-question"></i>';
# Thanks to this post:
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x
$ brew install cabextract
$ cd ~/Downloads
$ mkdir consolas
$ cd consolas
$ curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe
$ cabextract PowerPointViewer.exe
$ cabextract ppviewer.cab