This file contains 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.io.*; | |
public class Example { | |
private InputStream reportProducer(int lines) throws IOException { | |
var pin = new PipedInputStream(); | |
var pout = new PipedOutputStream(pin); | |
var out = new PrintStream(pout); | |
Runnable generator = () -> { | |
for (int i = 0; i < lines; i++) { |
This file contains 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
public class PlainThreads { | |
public static void main(String... args) { | |
for (int i = 0; i < 100; i++) { | |
new Thread(new Task1()).start(); | |
} | |
} | |
} |
This file contains 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
class Cell(index) { | |
doc "The index of the Cell inside its Matrix." | |
shared Integer index; | |
doc "The current state of the Cell." | |
shared variable Boolean state = false; | |
doc "The next state of the Cell." | |
variable Boolean ns = false; | |
shared Boolean nextState { return ns; } | |
assign nextState { |
This file contains 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
CREATE TABLE foo( | |
some_id SERIAL PRIMARY KEY, | |
another INT, | |
stuff VARCHAR(20) | |
); | |
CREATE OR REPLACE FUNCTION insert_crap_into_foo() RETURNS INTERVAL AS | |
$$ | |
DECLARE | |
counter INT := 0; |
This file contains 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
CREATE TABLE foo( | |
some_id SERIAL PRIMARY KEY, | |
another INT, | |
stuff VARCHAR(20) | |
); | |
CREATE OR REPLACE FUNCTION insert_crap_into_foo() RETURNS INTERVAL AS | |
$$ | |
DECLARE | |
counter INT := 0; |
This file contains 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
CREATE TABLE foo( | |
some_id SERIAL PRIMARY KEY, | |
another INT, | |
stuff VARCHAR(20) | |
); | |
CREATE OR REPLACE FUNCTION insert_crap_into_foo() RETURNS INTERVAL AS | |
$$ | |
DECLARE | |
counter INT := 0; |
This file contains 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
//Anything can only have two subtypes: Object and Null | |
shared abstract class Anything() of Object | Null {} | |
shared class Object() extends Anything() {} | |
//Null can only have one instance, called null | |
shared abstract class Null() | |
of null | |
extends Anything() {} |
This file contains 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 test "0.1" { | |
import "npm:uuid" "2.0.2"; | |
} |
This file contains 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
class BraindeadServer { | |
int port | |
private ServerSocket server | |
String response | |
void start() { | |
server = new ServerSocket(port) | |
byte[] buf = new byte[128] | |
new Thread({-> |
This file contains 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
class Parent { | |
String name | |
} | |
class External extends Parent { | |
String outer | |
Internal inner(String p) { | |
new Internal(inner:p) | |
} | |
class Internal { | |
String inner |
NewerOlder