export default function logger() {
var logger = function logger(){
};
logger.LEVEL = {
RUN : 0,
ERROR : 1,
WARN : 2,
LOG : 3,
INFO : 4,
DEBUG : 5,
FULL : 5,
};
logger.level = logger.LEVEL.FULL;
logger.debug = function(msg){ (this.level >= this.LEVEL.DEBUG) && console.debug(msg); };
logger.info = function(msg){ (this.level >= this.LEVEL.INFO) && console.info("%c "+ msg, "color: green"); };
logger.log = function(msg){ (this.level >= this.LEVEL.LOG) && console.log(msg); };
logger.warn = function(msg){ (this.level >= this.LEVEL.WARN) && console.warn(msg); };
logger.error = function(msg){ (this.level >= this.LEVEL.ERROR) && console.error(msg); };
return logger;
}
Last active
August 14, 2020 17:03
-
-
Save Phalacrocorax/f41f98432ad02a22e337cfdeeab768b5 to your computer and use it in GitHub Desktop.
[snippets] javascripts/js
Fashion frontend uh-huh
从gulp, sass, webpack, AMD, CommonJS, vuejs, vuex, es2015, babel, transpile 层出不穷。 本来npm这些nodejs之流就苦手 但是12条专业的JavaScript规则 | kancloud中有提到JS应该自动构建,实际使用中也确实的体会到了方便之处, 比如用了sass之后,再去改css简直就是折磨。
JavaScript Transpilers: What They Are & Why We Need Them
Uncaught TypeError / Uncaught RangeError / Uncaught URIError / InvalidStateError
有个一个自己常见的error: uncaught(in promise) message(The message port closed before a response was received)
目前只找到一篇讲promise的文章: You're Missing the Point of Promises
Author
Author
VUE
Author
Grab Data | js
755 daily latest posting time analysis
<a class="_2pN-CR8- Link" href="/okada-nana/18950" data-reactid="415"><time datetime="2018-04-25T10:19:40+09:00" data-reactid="416">1分前</time></a>
<a class="_2pN-CR8- Link" href="/okada-nana/18947" data-reactid="301"><time datetime="2018-04-24T22:31:26+09:00" data-reactid="302">11時間前</time></a>var time = document.getElementsByTagName('time');
var savedata = '';
for(var i=time.length-1;i>=0;i--)
{
savedata+=time[i].dateTime+'\n';
}
setTimeout(function(){
window.scrollTo( 0, 0 );
}, 500);
export_raw('okd.csv', savedata)
export_raw('yuiri.csv', savedata)
# export into table
select substr(post,1,10),max(substr(post,12,16)),max(post) from test_20180425
where substr(post,12,16) >= '14:00' or substr(post,12,16) <= '04:00'
group by substr(post,1,10)
order by substr(post,1,10)Get tweets with replies
var texts = [];
//node = document.querySelectorAll('article,span,time');
node = document.querySelectorAll('div[lang="ja"],*[dir="auto"],time');
for(i = 0;i < node.length; i++)
{
if(node[i].nodeName == "TIME"){
texts.push(node[i].getAttribute("datetime"));
}else{
texts.push(node[i].textContent);
}
}
var saveData = texts.join("\n");
console.log(saveData);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
js snippets
time format
JSON convert to
JavaScript正则进阶之路——活学妙用奇淫正则表达式
数组去重 / 获取url参数 / digital format / trim
js 只允许输入数字
js正则验证
h5 webapi 图片上传预览
判断是否移动端
scroll down hide scroll up show
中英文情况下判断字数并截取固定长度
csv-writter
csvWriter