Skip to content

Instantly share code, notes, and snippets.

View xtea's full-sized avatar

Jason xtea

View GitHub Profile
@xtea
xtea / TapeEquilibrium.java
Last active August 30, 2019 08:38
TapeEquilibrium - Codility
// you can also use imports, for example:
// import java.util.*;
// you can write to stdout for debugging purposes, e.g.
// System.out.println("this is a debug message");
class Solution {
public int solution(int[] A) {
// write your code in Java SE 8
int size = A.length;
{"sig":"310026e54272625e0bfdf382ec3619fe4f90be7d698629cd695bc91c7398efc2f1451fbcca5cbba300274f5b126021557f2e33186a2f4a60956968bd26f804b70","msghash":"8fff1ad7a2e821ce538e854aa89ebed636300b12b7fd4d79b743af4d839d4544"}
@xtea
xtea / jee7-websocket-configurator_pom.xml
Last active April 12, 2019 15:21
websocket demo base on tomcat 8
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pfl.samples</groupId>
<artifactId>jee7-websocket-configurator</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>jee7-websocket-configurer Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
@xtea
xtea / CollectionToArray.java
Created September 2, 2015 10:54
Collection convert to array in java
import java.util.ArrayList;
import java.util.Collection;
public class CollectionToArray {
public static void main(String[] args) {
Collection<String> collection = new ArrayList<String>();
collection.add("jack");
collection.add("john");
collection.add("jason");
@xtea
xtea / aop_TracePerformance.java
Created July 30, 2015 13:13
Spring aspectj annotation sample
package com.baidu.nightingale.common.aop;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 使用Spring AOP切面进行能分析. 将此注解声明在方法上,可将方法执行时间统计在LOG中
*
@xtea
xtea / DefaultAnnotationHandlerMapping.java
Created June 26, 2015 06:01
SpringMVC会自动为一个Conctroler的URL加上 .* 和 /
/**
* Add URLs and/or URL patterns for the given path.
* @param urls the Set of URLs for the current bean
* @param path the currently introspected path
*/
protected void addUrlsForPath(Set<String> urls, String path) {
urls.add(path);
if (this.useDefaultSuffixPattern && path.indexOf('.') == -1 && !path.endsWith("/")) {
urls.add(path + ".*");