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
/** | |
* Numerically re-prioritizable reference. | |
* Repurposes SoftReference.timestamp field as a priority value. | |
* <p> | |
* Intended to re-use all SoftReference-related VM features | |
* except its time-as-priority behavior. | |
* | |
* TODO this requires some modifications to internal JVM GC behavior. |
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
package sample | |
import kotlinx.cinterop.* | |
import platform.linux.inet_ntoa | |
import platform.posix.* | |
/** | |
* | |
*/ |
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.lang.reflect.Field; | |
import sun.misc.Unsafe; | |
public class Test { | |
private static final int N = 128 * 1024 * 1024; | |
public static void main(String[] args) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { | |
{ | |
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe"); |
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
@DslMarker | |
annotation class JSBuilderDsl | |
@DslMarker | |
annotation class JSSetterDsl | |
data class JSObj(val map: MutableMap<String, Any?> = linkedMapOf()) : MutableMap<String, Any?> by map { | |
object Arr { | |
@JSBuilderDsl |
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
cd repository | |
git checkout --orphan orphan_name | |
git rm -rf . | |
rm '.gitignore' | |
echo "#Title of Readme" > README.md | |
git add README.md | |
git commit -a -m "Initial Commit" | |
git push origin orphan_name |
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
#!/usr/bin/env bash | |
if [ ! -n "$1" ]; then | |
echo "usage: letsencrypt-jetty-auto.sh your_password_here" | |
exit 1 | |
fi | |
# input: fullchain.pem and privkey.pem as generated by the "letsencrypt-auto" script when run with | |
# the "auth" aka "certonly" subcommand |
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
package net.raboof.parser | |
// based on http://blogs.msdn.com/b/lukeh/archive/2007/08/19/monadic-parser-combinators-using-c-3-0.aspx | |
data class Result<TInput, TValue>(val value: TValue, val rest: TInput) | |
class Parser<TInput, TValue>(val f: (TInput) -> Result<TInput, TValue>?) { | |
operator fun invoke(input: TInput): Result<TInput, TValue>? = f(input) | |
infix fun or(other: Parser<TInput, TValue>): Parser<TInput, TValue> { |
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 HowDoIInnerHtml implements EntryPoint { | |
@Override | |
public void onModuleLoad() { | |
Element body = Document.get().getBody(); | |
DivElement newDiv = Document.get().createDivElement(); | |
newDiv.setClassName("foo"); | |
newDiv.setInnerText("Text in the div"); | |
SpanElement newSpan = Document.get().createSpanElement(); |