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 ch.claude_martin; | |
import java.text.MessageFormat; | |
import java.util.Arrays; | |
import java.util.Objects; | |
import java.util.function.Supplier; | |
class SomeClass { | |
/** |
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
/* | |
* Licence: | |
* | |
* Feel free to use this however you want with the following limitations. | |
* Don't change this licence here and don't remove it either. | |
* | |
* You can add it to your own namespace and alter the code as you wish. | |
* Please share the changes if you think they might be useful to others. | |
* |
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 ch.claude_martin.enumbitset; | |
import static java.util.Arrays.asList; | |
import java.util.stream.Collectors; | |
public class Main { | |
enum Bla implements EnumBitSetHelper<Bla> { | |
A(-1), B(42), C(108); |
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
public static void main(String args[]) { | |
String str = "abc"; | |
byte[] cstr = str.getBytes(); | |
cstr[0] = 'b'; | |
System.out.println(new String(cstr)); | |
System.out.println(str); // still "abc" -> it has not changed | |
} |
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 ch.claude_martin; | |
import java.util.function.Function; | |
import java.util.function.UnaryOperator; | |
public class YComb { | |
interface Fn2Op<T> extends Function<Fn2Op<T>, UnaryOperator<T>> { | |
@Override | |
UnaryOperator<T> apply(Fn2Op<T> x); |
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
public final class Child { | |
private final Object token; | |
private final SomeClass parent; | |
Child(SomeClass parent, Object token) { | |
this.parent = parent; | |
this.token = token; | |
} | |
public void doStuff() { |
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 ch.claude_martin.playground; | |
import java.io.IOException; | |
import javax.script.Bindings; | |
import javax.script.ScriptEngine; | |
import javax.script.ScriptEngineManager; | |
import javax.script.ScriptException; | |
import javax.script.SimpleBindings; |
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
#include <stdio.h> | |
#define MSGSIZE 16 | |
char *msg1 = “hello, world #1”; | |
char *msg2 =“ hello, world #2”; | |
char *msg3 =“ hello, world #3”; | |
main () { | |
char inbuf[MSGSIZE]; | |
int p[2], j, pid; |
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
/**************************** | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2015 Claude Martin | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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.example.foo; | |
import java.util.concurrent.locks.Condition; | |
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReentrantLock; | |
public class SomeClass { | |
public static void main(final String[] args) { | |
final Thread thread = new Thread(SomeClass::gameLoop); |