Skip to content

Instantly share code, notes, and snippets.

View hsipeng's full-sized avatar

Hsi P'eng hsipeng

View GitHub Profile
@hsipeng
hsipeng / ajax.js
Created July 24, 2017 08:45
传统ajax
document.getElementById("b1").onclick=function () {
//AJAX调用
/**
创建xmlHttpRequest
绑定回调函数
与服务器建立连接
发送数据
回调函数处理相应的数据
*/
var xmlhttp = createXMLHttpRequest();
@hsipeng
hsipeng / web.xml
Created July 24, 2017 14:37
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>AjaxServlet</servlet-name>
<servlet-class>servlet.AjaxServlet</servlet-class>
@hsipeng
hsipeng / user.html
Created July 24, 2017 15:06
JQuery 选择器的表单删除,添加,修改操作。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" src="../js/jquery-1.4.2.js"></script>
<title>添加用户</title>
</head>
<body>
<center>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<environments default="mysql">
<environment id="mysql">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver"/>
@hsipeng
hsipeng / MakePomFromJars.java
Created September 17, 2017 02:35
lib下的jars包转换为pom.xml中的依赖工具类
package com.user.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Date;
@hsipeng
hsipeng / nodelater.js
Created November 19, 2017 01:13
node later
var later = require('later');
var email = require('./src/emailtotask.js')
var news = require('./src/newstoarticle.js')
later.date.localTime();
var basic = {h: [23], m: [00]};
var composite = [
basic,
{h: [12], m: [00]},
@hsipeng
hsipeng / sql.js
Created November 19, 2017 01:14
node-mysql-util
var mysql = require('mysql');
var config = require('../config/default.js')
var pool = mysql.createPool({
host:config.database.HOST,
user:config.database.USER,
password:config.database.PASSWORD,
database:config.database.DATABASE,
});
@hsipeng
hsipeng / .editorconfig
Created November 19, 2017 01:20
eslint ..config
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
@hsipeng
hsipeng / Makefile
Created November 20, 2017 12:21
pandoc kindlegen 电子书生成
include_dir=build
source=chapters/*.md
title='Growth'
filename='growth'
all: html epub rtf pdf mobi
markdown:
awk 'FNR==1{print ""}{print}' $(source) > $(filename).md
@hsipeng
hsipeng / build.xml
Last active November 23, 2017 11:18
ant build.xml template
<?xml version="1.0"?>
<project name="CSJ-Buttonz" basedir="." default="startant">
<property name="src.dir" value="src"/>
<property name="resource.dir" value="resource"/>
<property name="web.dir" value="WebContent"/>
<property name="catalina.home" value="/usr/local/tomcat/apache-tomcat-8.0.47" />
<property name="build.dir" value="${web.dir}/WEB-INF/classes"/>
<property name="webapp.name" value="CSJ-Buttonz"/>
<path id="master-classpath">