Skip to content

Instantly share code, notes, and snippets.

View adamretter's full-sized avatar
🎩
Down the Code Mine

Adam Retter adamretter

🎩
Down the Code Mine
View GitHub Profile
static std::string copyString(JNIEnv* env, jstring js) {
const char *utf = env->GetStringUTFChars(js, NULL);
std::string name = std::string(utf);
env->ReleaseStringUTFChars(js, utf);
return name;
}
public class TernaryNpe {
public static void main(String args[]) {
final String a = "a";
final String aa = "aa";
final String b = null;
final String bb = "";
/* Test Case 1 */
@adamretter
adamretter / JUnitConsoleRunner.java
Created November 4, 2014 22:55
JUnitRunner with output to the console
package org.rocksdb.test;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.internal.JUnitSystem;
import org.junit.internal.RealSystem;
import org.junit.internal.TextListener;
public class JUnitConsoleRunner {
public final static void main(final String args[]) {
@adamretter
adamretter / CustomJunitRunner.java
Created March 16, 2015 21:25
Example if a JUnit Listener which prints the test name to the console
import org.junit.internal.JUnitSystem;
import org.junit.internal.RealSystem;
import org.junit.internal.TextListener;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import java.util.ArrayList;
import java.util.List;
/**
package xpdl;
typedef HString = String;
package xpdl.xdm;
import xpdl.HString;
interface Item {
public function stringValue() : xpdl.xdm.String;
}
class String implements Item {
var value: HString;
$ git show-ref --tags
44f824e4ead5e2516a6abf2db9cd91bf1e9a9a99 refs/tags/eXist-2.2
6f67af030cd534df60209e6e78c13a4cd88ff6fc refs/tags/eXist-2.2.RC1
28f90f702e9f8228485985f8bfe093d4392a8666 refs/tags/eXist-2.2.RC2
$ git checkout 6f67af030cd534df60209e6e78c13a4cd88ff6fc
Checking out files: 100% (2471/2471), done.
Note: checking out '6f67af030cd534df60209e6e78c13a4cd88ff6fc'.
You are in 'detached HEAD' state. You can look around, make experimental
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 91.121.89.146
netmask 255.255.255.0
@adamretter
adamretter / interfaces
Last active August 29, 2015 14:24
kvm-guest
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 5.196.205.132
netmask 255.255.255.255
broadcast 5.196.205.132
gateway 91.121.89.254
post-up /sbin/route add 91.121.89.254 dev eth0
@adamretter
adamretter / TestingUnapply.scala
Created August 11, 2015 22:21
Trying to pass unapply types
object TestingUnapply {
sealed trait Thing
case class ThingA(a: String) extends Thing
case class ThingB(b: String, thingA: ThingA) extends Thing
val x: Thing = ThingA("hello")
val y: Thing = ThingB("goodbye", ThingA("maybe"))
process(x, new { def unapply(thing: ThingA) = ThingA.unapply(thing)})