Skip to content

Instantly share code, notes, and snippets.

View hacke2's full-sized avatar
🐜
ant has power

hacke2 hacke2

🐜
ant has power
View GitHub Profile
@hacke2
hacke2 / ajax.js
Last active August 29, 2015 14:05
自己封装的JAJAX
function Ajax(parametObject) {
var xhr, responseType, defineParam, method, url, data;
defineParam = {
method : "GET",
type : "json"
}
url = parametObject.url;
data = parametObject.data;
responseType = parametObject.type || defineParam.type;
@hacke2
hacke2 / drag.js
Created August 25, 2014 13:47
拖拽
var drag = document.getElementById('drag');
var inputX = document.getElementById('x');
var inputY = document.getElementById('y');
if(document.attachEvent){
drag.attachEvent('onmousedown',dragHandle);
}else{
drag.addEventListener('mousedown', dragHandle,false);
}
function dragHandle(event){
var event = event||window.event;
@hacke2
hacke2 / htmlEscape.js
Created August 25, 2014 13:47
处理一些文本里的HTML标签
function htmlEscape(text) {
return text.replace(/[<>"&]/g, function(match, pos, originalText){
switch(match) {
case "<" : return "&lt;";
case ">" : return "&gt;";
case "\"" : return "&amp;";
case "&" : return "&quot;";
}
});
}
@hacke2
hacke2 / randomMN.js
Created August 25, 2014 13:48
m-n的随机数
parseInt(Math.random())*(n-m)+m;
@hacke2
hacke2 / animate.js
Created August 25, 2014 13:48
从左上角弹出
$box.animate({
width: this.mWidth "px",
height: this.mHeight "px",
"left": browserWidth / 2 - this.mWidth / 2 "px",
"top": browserHeight / 2 - this.mHeight / 2 "px"
}, 300);
@hacke2
hacke2 / common.js
Last active August 29, 2015 14:05
管理学院Js
function trim(s) {
return s.replace(/^\s*/, "").replace(/\s*$/, "");
}
/*
* 限制字数,第一个传要限制的className,第二个传限制的字数
* @author: wxl
**/
function limitTextNum(className, num) {
@hacke2
hacke2 / 关键代码,java
Created August 25, 2014 13:50
项目实战之Quartz与Spring整合进行热部署的设计与实现
private static long curModifiedTime;
static {
try {
curModifiedTime = new File(filePath).lastModified();
System.out.println("当前文件修改时间为 " +curModifiedTime);
} catch (Exception e) {
e.printStackTrace();
}
}
@hacke2
hacke2 / LogProxy.java
Created August 25, 2014 13:51
动态代理及JDK动态代理源码分析
public class LogProxy implements InvocationHandler {
private Object object;
public LogProxy(Object object) {
super();
this.object = object;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
@hacke2
hacke2 / cutPic.aspx
Created August 25, 2014 13:52
管理学院图片裁剪
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%String basePath = (Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<base href="<%=basePath %>" />
<title>CuttingPic</title>
<script type='text/javascript' src='Content/Scripts/Component/loadJsCss.js'></script>
@hacke2
hacke2 / page.html
Created August 26, 2014 02:19
分页
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jquery实现无刷新分页</title>
<style type="text/css">
body{
font-family: "微软雅黑";
font-size: 13px;
}