Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

front-thinking

🎯
Focusing
  • Tencent
  • ShenZhen,China
View GitHub Profile
View cloudSettings
{"lastUpload":"2020-06-02T09:16:19.677Z","extensionVersion":"v3.4.3"}
@front-thinking
front-thinking / introrx.md
Created May 29, 2018 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
@front-thinking
front-thinking / memorySizeOfObject.js
Created Jan 12, 2017 — forked from zensh/memorySizeOfObject.js
calculate memory size of javascript object, it is not a accurate value!
View memorySizeOfObject.js
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@front-thinking
front-thinking / iterator.js
Created Jan 12, 2016
自己动手实现的迭代器-简易版
View iterator.js
var each = function (arr, callback){
for(var i=0, l=arr.length; i<l; i++){
callback.call(arr[i], i, arr[i]);
}
};
each([1, 2, 3], function (i, n){
console.log([i, n]);
});
@front-thinking
front-thinking / imagePreloader.js
Created Jan 12, 2016
图片预加载(代理模式)
View imagePreloader.js
var myImage = (function (){
var imgNode = document.createElement('img');
document.body.appendChild(imgNode);
return {
setSrc: function(src){
imgNode.src = src;
}
}
})();
@front-thinking
front-thinking / 404checker.js
Created Oct 21, 2015 — forked from n1k0/404checker.js
A CasperJS script to check for 404 & 500 internal links on a given website
View 404checker.js
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/
View 前端打点.md

前端错误监控

注:目前是前端实验性质的工具。

开发环境和用户使用环境不一致,开发时无法对所有浏览器做测试。但是由用户来反馈错误过于被动。为了主动地收集错误并解决,在网页上加了一个JavaScript错误监控脚本。

window.onerror捕获页面上的JavaScript运行错误,并使用beacon的方式保存到seedit.duapp.com上。

window.onerror

@front-thinking
front-thinking / frontendDevlopmentBookmarks.md
Created Oct 12, 2015 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
View frontendDevlopmentBookmarks.md