Skip to content

Instantly share code, notes, and snippets.

View webjohnjiang's full-sized avatar
:octocat:
I may be slow to respond.

johnjiang webjohnjiang

:octocat:
I may be slow to respond.
View GitHub Profile
@webjohnjiang
webjohnjiang / analytics.js
Created January 2, 2020 12:26 — forked from zmmbreeze/analytics.js
GA的源码 analytics.js
(function() {
/**
* 记录方法使用情况的类
* @param {Array.<boolean>} umMap 初始的使用情况
*/
var UsageManager = function(umMap) {
this.umMap = umMap || [];
};
/**
* 记录新的使用情况
javascript:(function(){function c(){var e=document.createElement("link");e.setAttribute("type","text/css");e.setAttribute("rel","stylesheet");e.setAttribute("href",f);e.setAttribute("class",l);document.body.appendChild(e)}function h(){var e=document.getElementsByClassName(l);for(var t=0;t<e.length;t++){document.body.removeChild(e[t])}}function p(){var e=document.createElement("div");e.setAttribute("class",a);document.body.appendChild(e);setTimeout(function(){document.body.removeChild(e)},100)}function d(e){return{height:e.offsetHeight,width:e.offsetWidth}}function v(i){var s=d(i);return s.height>e&&s.height<n&&s.width>t&&s.width<r}function m(e){var t=e;var n=0;while(!!t){n+=t.offsetTop;t=t.offsetParent}return n}function g(){var e=document.documentElement;if(!!window.innerWidth){return window.innerHeight}else if(e&&!isNaN(e.clientHeight)){return e.clientHeight}return 0}function y(){if(window.pageYOffset){return window.pageYOffset}return Math.max(document.documentElement.scrollTop,document.body.scrollTop)}funct
@webjohnjiang
webjohnjiang / 0_reuse_code.js
Created September 19, 2017 07:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@webjohnjiang
webjohnjiang / location.js
Created September 19, 2017 07:30
Hijacking native objects for chrome
function location(){}
var _location = window.document.location;
location.__proto__ = _location;
location.__defineSetter__('href', function(url) {
_location.href = "FreeBuf.COM | 关注黑客与极客";
});
@webjohnjiang
webjohnjiang / sublimetext.bat
Created October 13, 2016 03:15 — forked from hizhengfu/sublimetext.bat
sublime text window下右键菜单。 保存为bat文件,放入sublimetext安装文件夹与sublime_text同级,双击执行即可。 能打开带空格文件夹下的文件。 注意:这个文件最好是复制并用记事本保存,直接下载的有可能存在换行问题导致不能正常使用。 支持文件夹右键;
@Echo Off
Title SublimeText 右键菜单维护
Pushd %~dp0
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" (Set a="HKLM\SOFTWARE\Wow6432Node\SublimeText\sublimetext_backwnd" /v&Set b=%SystemRoot%\SysWOW64) Else (Set a="HKLM\SOFTWARE\SublimeText\sublimetext_backwnd" /v&Set b=%SystemRoot%\system32)
Rd "%b%\test_permission" >nul 2>nul
Md "%b%\test_permission" 2>nul||(Echo 请使用右键管理员身份运行&&Pause >nul&&Exit)
Rd "%b%\test_permission" >nul 2>nul