Skip to content

Instantly share code, notes, and snippets.

Christopher chRyNaN

Block or report user

Report or block chRyNaN

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chRyNaN
chRyNaN / Optional.java
Created Feb 18, 2017
A Java 8 Optional representation using RxJava.
View Optional.java
import java.util.NoSuchElementException;
import rx.functions.Action1;
import rx.functions.Func1;
/**
* Created by ckeenan on 2/18/17. A Java 8 Optional representation using RxJava.
*/
public class Optional<T> {
@chRyNaN
chRyNaN / Escape.js
Last active Apr 29, 2016
JavaScript code that parses HTML/XHTML escape characters
View Escape.js
(function(){
/**
* Code is heavily influenced from Underscore.js (their escape and unescape functions):
* https://github.com/jashkenas/underscore/blob/master/underscore.js
*/
window.Code = {};
var escapeMap = {
'&': '&amp;',
@chRyNaN
chRyNaN / AbstractJob.java
Last active Mar 31, 2016
Android classes to simplify performing tasks of different types using a job queue.
View AbstractJob.java
import android.os.Looper;
import java.util.ArrayList;
import java.util.List;
/**
* Created by chRyNaN on 3/31/2016. An abstract class implementation of the Job interface to handle some boilerplate code.
*/
public abstract class AbstractJob implements Job {
private List<JobCompletedListener> listeners;
@chRyNaN
chRyNaN / ItemAdapter.java
Created Mar 31, 2016
Classes to bridge the gap between RecyclerView and ListView by providing a common API.
View ItemAdapter.java
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
@chRyNaN
chRyNaN / ItemAdapter.java
Created Mar 30, 2016
An Android RecyclerView adapter class that adds ArrayAdapter functionality.
View ItemAdapter.java
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
@chRyNaN
chRyNaN / ArrayObjectAnimator.java
Created Mar 25, 2016
An Android class that supports animating over an array of values.
View ArrayObjectAnimator.java
import android.animation.AnimatorSet;
import android.animation.TimeInterpolator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import java.lang.reflect.Field;
/**
* Created by chRyNaN on 3/24/2016. This class encapsulates an AnimatorSet and an ObjectAnimator (actually a ValueAnimator
* but it updates the value of an Object similar to how an ObjectAnimator works) and performs animations over an array of
@chRyNaN
chRyNaN / ViewUtils.java
Created Mar 25, 2016
A convenient utility class for Android Views.
View ViewUtils.java
import android.animation.Animator;
import android.animation.TimeInterpolator;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
@chRyNaN
chRyNaN / JSONSerializer.java
Created Jan 9, 2016
Simple JSONObject Serialization
View JSONSerializer.java
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
@chRyNaN
chRyNaN / User.java
Created Jan 21, 2015
Simple Entity Structure Implementation for User
View User.java
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
@chRyNaN
chRyNaN / DefaultListener.java
Last active Sep 30, 2019
Server-Sent Event Java Servlet backend
View DefaultListener.java
public interface DefaultListener {
public void onNotification(NotificationEvent event);
}
You can’t perform that action at this time.