Skip to content

Instantly share code, notes, and snippets.

View ianunruh's full-sized avatar

Ian Unruh ianunruh

View GitHub Profile
@briancain
briancain / Vagrantfile
Last active August 29, 2015 14:03
Multi-master Split PE install Vagrant Script (does not install PE)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
BOX = "centos-65-x64-virtualbox-nocm.box"
# Multi-node setup
# Make sure to run this:
# vagrant plugin install vagrant-hostmanager
@JakeWharton
JakeWharton / OkHttpStack.java
Created May 21, 2013 01:14
A `HttpStack` implementation for Volley that uses OkHttp as its transport.
import com.android.volley.toolbox.HurlStack;
import com.squareup.okhttp.OkHttpClient;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* An {@link com.android.volley.toolbox.HttpStack HttpStack} implementation which
* uses OkHttp as its transport.
*/
@ficusk
ficusk / GsonRequest.java
Last active April 9, 2024 09:03
A Volley adapter for JSON requests that will be parsed into Java objects by Gson.
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
@bensie
bensie / base.rb
Created December 6, 2012 17:53
Sinatra API Helpers
require "sinatra/base"
require "sinatra/namespace"
require "multi_json"
require "api/authentication"
require "api/error_handling"
require "api/pagination"
module Api
class Base < ::Sinatra::Base
@JakeWharton
JakeWharton / BaseActivity.java
Created July 6, 2012 01:17
Scoped event bus which automatically registers and unregisters with the lifecycle.
package com.squareup.example;
public abstract BaseActivity extends SherlockActivity {
private final ScopedBus scopedBus = new ScopedBus();
protected ScopedBus getBus() {
return scopedBus;
}
@Override public void onPause() {
@ianunruh
ianunruh / RecursiveSortFilterProxyModel.java
Created March 21, 2012 09:07
RecursiveSortFilterProxyModel
import com.trolltech.qt.core.QModelIndex;
import com.trolltech.qt.gui.*;
public class RecursiveSortFilterProxyModel extends QSortFilterProxyModel {
protected boolean filterAcceptsRow(int row, QModelIndex parent) {
if(super.filterAcceptsRow(row, parent)) {
return true;
}
QStandardItemModel model = (QStandardItemModel)sourceModel();