Skip to content

Instantly share code, notes, and snippets.

View psamsotha's full-sized avatar

Paul Samsotha psamsotha

View GitHub Profile
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@psamsotha
psamsotha / TestFrameworkStarter.java
Last active April 29, 2020 15:35
Starter for Jersey Test Framework
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import java.io.Closeable;
import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
package com.example;
import java.io.IOException;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import javax.ws.rs.GET;
import java.io.InputStream;
import java.net.URI;
import java.util.logging.Logger;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import java.util.function.Supplier;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import org.glassfish.hk2.api.Factory;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
@psamsotha
psamsotha / main.ts
Created July 8, 2016 04:28
Get external configuration file before bootstrap in Angular 2. See also https://blog.sstorie.com/providing-external-data-when-bootstrapping-angular-2/
import { bootstrap } from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS } from '@angular/http';
import { Http,
Request,
Response,
XSRFStrategy,
CookieXSRFStrategy } from '@angular/http';
import { Injector,
ReflectiveInjector } from '@angular/core';
import { Observable } from 'rxjs/Rx';
@psamsotha
psamsotha / AsyncTest.java
Last active August 27, 2018 01:45
A Jersey client test using Jersey Test Framework to show how to make async requests.
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
import javax.ws.rs.client.InvocationCallback;
@psamsotha
psamsotha / SwingSOLinks.md
Last active July 25, 2018 17:22
Links to some Stack Overflow questions tagged with Swing (all my answers)
@psamsotha
psamsotha / sed cheatsheet
Created July 21, 2018 22:09 — forked from ssstonebraker/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'