This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('xdiamondApp') | |
.factory('AlertService', ['$timeout', '$rootScope', function ($timeout, $rootScope) { | |
var service = {}; | |
var alerts = []; | |
//all template can use alerts like follow: | |
//<alert ng-repeat="alert in alerts" type="{{alert.type}}" close="alert.close()">{{ alert.msg }}</alert> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.github.xdiamond.web.filter; | |
import java.io.IOException; | |
import javax.servlet.Filter; | |
import javax.servlet.FilterChain; | |
import javax.servlet.FilterConfig; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletRequest; | |
import javax.servlet.ServletResponse; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scheduleJobManager.addScheduleJob(new ScheduleJobSupport(){ | |
{ | |
this.setInterval(intervalx); | |
} | |
@Override | |
public boolean permitAdd() { | |
return false; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Stack; | |
/** | |
* from org.apache.commons.io.FilenameUtils | |
* | |
* @author hengyunabc | |
* | |
*/ | |
public class MatchUtils { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.SecureRandom; | |
public class PenneyGame { | |
static SecureRandom random = new SecureRandom(); | |
public static void main(String[] args) { | |
int count = 100; | |
int winCount = 0; | |
for (int i = 0; i < 100; ++i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.management.ManagementFactory; | |
import java.lang.management.OperatingSystemMXBean; | |
import com.sun.management.UnixOperatingSystemMXBean; | |
public class Test { | |
public static void main(String[] args) { | |
OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean(); | |
if (operatingSystemMXBean instanceof UnixOperatingSystemMXBean) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @author hengyunabc 2017-10-12 | |
* | |
*/ | |
public class ClassLoaderUtils { | |
@SuppressWarnings({ "restriction", "unchecked" }) | |
public static URL[] getUrls(ClassLoader classLoader) { | |
if (classLoader instanceof URLClassLoader) { | |
return ((URLClassLoader) classLoader).getURLs(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.objectweb.asm.*; | |
public class CDump implements Opcodes { | |
public static byte[] dump() throws Exception { | |
ClassWriter cw = new ClassWriter(0); | |
FieldVisitor fv; | |
MethodVisitor mv; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.atomic.AtomicInteger; | |
public class ThreadId { | |
// Atomic integer containing the next thread ID to be assigned | |
private static final AtomicInteger nextId = new AtomicInteger(0); | |
// Thread local variable containing each thread's ID | |
private static final ThreadLocal<Integer> threadId = new ThreadLocal<Integer>() { | |
@Override | |
protected Integer initialValue() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.annotation.Annotation; | |
import java.lang.annotation.Documented; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Repeatable; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.util.Arrays; | |
import abc.Test.AAA; |