Skip to content

Instantly share code, notes, and snippets.

@ctmay4
ctmay4 / Staging.java
Created January 14, 2020 20:49
Generic field description lookup for staging-client-java
/**
* Get the description of a staging field value. This will work for any field with a lookup and will return the first
* description field from the matching row. It will return null if there is not a match on schema, field, or table row.
*/
public static String getFieldValueDescription(StagingSchema schema, String field, String value) {
if (schema == null)
return null;
// get the correct staging module
Staging staging;
@ctmay4
ctmay4 / Stretch.java
Last active February 28, 2019 03:10
Stretch project
import java.util.Scanner;
/**
* Stretch project
*/
public class Stretch {
private static char OPEN = 'O';
private static char BLOCKED = 'X';
@ctmay4
ctmay4 / build.gradle
Created March 16, 2015 21:06
Grade Nexus Plugin missing dependencies (2.1.1 vs. 2.3)
import org.gradle.internal.jvm.Jvm
plugins {
id 'java'
id 'checkstyle'
id 'findbugs'
id 'com.bmuschko.nexus' version '2.1.1'
}
group = 'com.imsweb'
@ctmay4
ctmay4 / DiffTesting.java
Last active August 29, 2015 14:15
Java object diff testing with List<String> changes
import java.util.ArrayList;
import java.util.List;
import org.javers.core.Javers;
import org.javers.core.JaversBuilder;
import org.javers.core.MappingStyle;
import org.javers.core.changelog.SimpleTextChangeLog;
import org.javers.core.diff.Change;
import org.javers.core.metamodel.clazz.EntityDefinition;
import org.javers.core.metamodel.object.InstanceIdDTO;
@ctmay4
ctmay4 / DiffTesting.java
Last active August 29, 2015 14:13
Java object diff testing
import java.util.Arrays;
import java.util.List;
import org.javers.core.Javers;
import org.javers.core.JaversBuilder;
import org.javers.core.MappingStyle;
import org.javers.core.changelog.SimpleTextChangeLog;
import org.javers.core.diff.Change;
import org.javers.core.metamodel.object.InstanceIdDTO;
import org.junit.Test;
@ctmay4
ctmay4 / VersionComperator.java
Last active August 29, 2015 14:06
Version string sorting
import java.util.Comparator;
/**
* A Comparator for version strings. Version strings are assumed to be only numbers and periods. Here are
* some examples:
* <p/>
* 1.0
* 3.4.1
* 123.43.123.1
* <p/>
@ctmay4
ctmay4 / server.js
Created July 10, 2014 12:36
Proxy requests with Node
var request = require('request');
var appUrl = 'https://api.seer.cancer.gov/rest/';
app.use('/api', function(req, res) {
url = apiUrl + req.url;
req.pipe(request(url)).pipe(res);
});
@ctmay4
ctmay4 / Gruntfile.js
Last active August 29, 2015 14:03
Simple node server
module.exports = function(grunt) {
grunt.initConfig({
// configure nodemon
nodemon: {
dev: {
script: 'server.js'
}
}