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 com.vertigrated.mbean.jackson; | |
import com.fasterxml.jackson.core.JsonGenerator; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.databind.JsonSerializer; | |
import com.fasterxml.jackson.databind.SerializerProvider; | |
import weblogic.health.HealthState; | |
import java.io.IOException; |
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
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
function debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
clearTimeout(timeout); | |
timeout = setTimeout(function() { |
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
{ | |
"$schema": "http://json-schema.org/schema#", | |
"definitions": { | |
"uuid": { | |
"title": "uuid", | |
"description": "UUID ( http://regex101.com/r/eJ7gN2 )", | |
"type": "string", | |
"minLength": 36, | |
"maxLength": 36, | |
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" |
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 org.junit.Test; | |
import javax.annotation.Nonnull; | |
import java.util.*; | |
public class TestRandomzingIterator | |
{ | |
@Test | |
public void testRandomIteration() | |
{ |
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
// Only add if it doesn't exist yet! | |
if (!String.prototype.format) { | |
String.prototype.format = function() { | |
var str = this.toString(); | |
if (!arguments.length) | |
return str; | |
var args = typeof arguments[0], | |
args = (("string" == args || "number" == args) ? arguments : arguments[0]); | |
for (arg in args) | |
str = str.replace(RegExp("\\{" + arg + "\\}", "gi"), args[arg]); |
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.List; | |
import java.util.Random; | |
/** | |
* See what it looks like in JVisualVM | |
* https://www.evernote.com/shard/s17/sh/430c9fd1-203a-45da-9194-b7cb20dbdf0f/4f67d91157f68db32e43badd9d806f1c/deep/0/Java-VisualVM.png | |
*/ | |
public class TrustTheGarbageCollector | |
{ |
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
Ext.define('Ext.grid.plugin.CellToolTip', { | |
extend: 'Ext.AbstractPlugin', | |
alias: 'plugin.CellQTip', | |
config: { | |
debug: false | |
}, | |
init: function(grid) { | |
// You may not need the scope, but if you do, this binding will |
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
importScripts('spark-md5.min.js'); | |
function calcMD5(f) { | |
var blobSlice = Blob.prototype.slice; | |
var chunkSize = 2097152; | |
var chunks = Math.ceil(f.size/chunkSize); | |
var spark = new SparkMD5.ArrayBuffer(); | |
var currentChunk = 0; | |
var fr = new FileReader(); |
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 com.stackoverflow.Q18818482; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.concurrent.*; | |
public class Question18818482 | |
{ |
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 javax.management.InstanceAlreadyExistsException; | |
import javax.management.JMX; | |
import javax.management.MBeanRegistrationException; | |
import javax.management.MBeanServer; | |
import javax.management.MalformedObjectNameException; | |
import javax.management.NotCompliantMBeanException; | |
import javax.management.ObjectName; | |
import java.lang.management.ManagementFactory; | |
public class MyApp |