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
/* | |
* This is free and unencumbered software released into the public domain. | |
* | |
* Anyone is free to copy, modify, publish, use, compile, sell, or | |
* distribute this software, either in source code form or as a compiled | |
* binary, for any purpose, commercial or non-commercial, and by any | |
* means. | |
* | |
* In jurisdictions that recognize copyright laws, the author or authors | |
* of this software dedicate any and all copyright interest in the |
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.reflect.InvocationHandler; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Proxy; | |
import java.util.concurrent.BlockingQueue; | |
import java.util.concurrent.FutureTask; | |
import java.util.concurrent.LinkedBlockingQueue; | |
public class Main { | |
public static void main(String[] args) { | |
var a1 = proxy(new TestActor("ta1"), Actor.class); |
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
// Roguh translation for my first approach, that had no way to an | |
// underlying error that occurred during execution of the tasks | |
class test { | |
public <V> List<V> test(List<Callable<V>> someTasks) { | |
try (var se = StructuredExecutor.open()) { | |
var futures = someTasks.stream() | |
.map(se::fork); | |
se.join(); |
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
(async () => { | |
let response = await fetch('/system/console/status-pattern-detector.json'); | |
let text = await response.text(); | |
let json = text.replaceAll(/\n/g, ',') | |
.slice(0, -1); | |
let items = JSON.parse(`[${json}]`); | |
function getComponentName(item) { | |
//get the component name from the item | |
return ""; |
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
module = module ? {} | |
module.exports = (robot) -> | |
class Factoid | |
constructor: (@x, @v, @y) -> | |
robot.logger.info("making factoid [#{@x}, #{@v}, #{@y}]") | |
@y = if Array.isArray(@y) then @y else [@y] | |
respond: (robot, message) -> | |
robot.logger.info("responding to [#{@x}, #{@v}, #{@y}]") | |
switch @v |
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
window.addEventListener('storage', function(e) { | |
if (e.storageArea === localStorage) { | |
var key = e.key; | |
if (data) { | |
$(document).trigger('storage.' + e.key, data); | |
} | |
} | |
}); | |
$(document).on("storage.test", function(e, data) { |
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
(function($) { | |
$.expr[":"].parents = $.expr.createPseudo(function(arg) { | |
return function( elem ) { | |
return $(elem).parents(arg).length > 0; | |
}; | |
}); | |
})(jQuery); |
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
if (!Math.minMax) { | |
Math.minMax = function(min, max, val) { | |
return Math.max(min, Math.min(max, val)); | |
}; | |
} |
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
(function($, window) { | |
var $w = $(window); | |
$.fn.center = function() { | |
this.css({ | |
position: "absolute", | |
left: Math.max(0, ($w.width() - this.outerWidth()) / 2 + $(window).scrollTop()) + "px", | |
top: Math.max(0, ($w.height() - this.outerHeight()) / 2 + $(window).scrollTop()) + "px" | |
}); | |
}; |
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
(function($) { | |
$.fn.showWhile = function(fn) { | |
var obj = this.show(); | |
var result = fn(); | |
if (typeof result.then !== "function") { | |
result = $.Deferred.resolve(fn).promise(); | |
} | |
NewerOlder