Skip to content

Instantly share code, notes, and snippets.

View Artur-Sulej's full-sized avatar
🦀
Open for Rust opprtunities!

Artur Sulej Artur-Sulej

🦀
Open for Rust opprtunities!
View GitHub Profile
@Artur-Sulej
Artur-Sulej / ListViewAdapter.java
Last active March 30, 2016 13:14
Generic adapter for feeding ListViews with custom view loaded with data.
public abstract class ListViewAdapter <T> extends BaseAdapter {
protected ListView listView;
private ArrayList<T> objects = new ArrayList<T>();
public void updateData(ArrayList<T> objects) {
this.objects = objects;
notifyDataSetChanged();
}
@Artur-Sulej
Artur-Sulej / ListStorage.java
Last active December 3, 2015 01:22
Generic classes for storing objects and list of objects serialized to JSON in Android.
import android.content.SharedPreferences;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
@Artur-Sulej
Artur-Sulej / HTTP_Error
Created August 4, 2015 10:54
Convenient function for creating http errors in JavaScript.
function HTTP_Error(msg, status) {
var error = new Error(msg);
error.status = status;
return error;
}