Skip to content

Instantly share code, notes, and snippets.

@aliencode
aliencode / seconds.md
Created September 11, 2013 07:39
秒单位换算
0,000 000 000 000 000 000 000 001	yoctosecond [ ys ]
0,000 000 000 000 000 000 001	        zeptosecond [ zs ]
0,000 000 000 000 000 001	        attosecond [ as ]
0,000 000 000 000 001	                femtosecond [ fs ]
0,000 000 000 001                       [ trillionth ]	picosecond [ ps ]
0,000 000 001                           [ billionth ]	nanosecond [ ns ]
0,000 001                               [ millionth ]	microsecond [ µs ]
0,001                                   [ thousandth ]	millisecond [ ms ]
0.01 [ hundredth ]	centisecond [ cs ]
@aliencode
aliencode / default.xml
Created September 15, 2013 03:29
使用SPRING MVC时让WEB容器处理静态资源
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/static/*</url-pattern>
</servlet-mapping>
@aliencode
aliencode / ServiceLoader.md
Last active December 23, 2015 18:59
通过接口加载其实现子类

##java

package com.demo;
public abstract class Service1 {
    private static Service1 getInstance() {
    	return ServiceLoader.load(Service1.class).iterator().next();
    }
}
@aliencode
aliencode / js.utils.md
Last active December 24, 2015 15:59
js 常用函数

##replace 替换/和. 为 -

function convertToid(path) {
    return  path.replace(/\.|\//g, '-')
}

##endwith

@aliencode
aliencode / angularjs.md
Created October 5, 2013 05:43
angularJS一些

##$q的使用

var q = $q.defer(),
    p = q.promise;

chrome.fileSystem.chooseEntry({type: "openWritableFile", accepts: [
        {extensions: ["md"]}
    ]},
    function (entry) {
@aliencode
aliencode / jsbin.OQEbOPE.html
Last active December 25, 2015 11:49
angularjs service,factory,provider区别
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta name="description" content="angularjs service,factory,provider区别" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.0.1/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-controller="MyCtrl">
{{serviceOutput}}
@aliencode
aliencode / jquery-table-checkbox.js
Created November 19, 2013 06:31
jquery table checkbox 列选择
$('table tr input[type=checkbox]:nth-child(1) ').prop('checked', $(e.target).prop('checked'));
@aliencode
aliencode / HttpServletResponse.md
Last active January 4, 2016 13:39
HttpServletResponse 增加输出

##HttpServletResponse 流只能读取一次,通过以下方法增加输出

public class ResponseLoggingFilter extends GenericFilterBean {

   @Override
   public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
      HttpServletResponse responseWrapper = loggingResponseWrapper((HttpServletResponse) response);     
      filterChain.doFilter(request, responseWrapper);
 }
@aliencode
aliencode / tomcat-users.xml
Created March 19, 2014 07:33
Tomcat 管理员 权限配置
<tomcat-users>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
@aliencode
aliencode / jenkins.sh
Created May 7, 2014 06:22
jenkins.sh 启动脚本
#!/bin/sh
DESC="Jenkins CI Server"
NAME=jenkins
PIDFILE=$NAME.pid
COMMAND="${PWD}/jdk1.7.0_21/bin/java -- -Xms128m -Xmx1024m -jar ${PWD}/jenkins.war"
d_start() {
export JENKINS_HOME=${PWD}/.jenkins