Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Samsotha psamsotha

View GitHub Profile
View CloseableServiceTest.java
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;
View StackOverflow_55711784_2587435.java
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;
View MultiPartTest.java
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;
View FactoryRankTest.java
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 / AsyncTest.java
Last active Aug 27, 2018
A Jersey client test using Jersey Test Framework to show how to make async requests.
View AsyncTest.java
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 Jul 25, 2018
Links to some Stack Overflow questions tagged with Swing (all my answers)
View SwingSOLinks.md
View 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'
@psamsotha
psamsotha / Makefile
Created Jul 21, 2018 — forked from postmodern/Makefile
A generic Makefile for building/signing/install bash scripts
View Makefile
NAME=project
VERSION=0.0.1
DIRS=etc lib bin sbin share
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
INSTALL_FILES=`find $(DIRS) -type f 2>/dev/null`
DOC_FILES=*.md *.txt
PKG_DIR=pkg
PKG_NAME=$(NAME)-$(VERSION)
@psamsotha
psamsotha / CompleteTestExample.java
Created May 3, 2018
Example of complete JerseyTest
View CompleteTestExample.java
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import static org.assertj.core.api.Assertions.assertThat;
@psamsotha
psamsotha / woocommerce_change_view_cart.php
Created Mar 26, 2018
Override function in WooCommerce to change View Cart Text.
View woocommerce_change_view_cart.php
<?php
function woocommerce_widget_shopping_cart_button_view_cart() {
echo '<a href="' . esc_url( wc_get_cart_url() ) . '" class="button wc-forward">' . esc_html__( 'View cart', 'woocommerce' ) . '</a>';
}
?>
You can’t perform that action at this time.