Skip to content

Instantly share code, notes, and snippets.

Mike Dunn moagrius

  • Austin, TX
Block or report user

Report or block moagrius

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
View java-default-constructors.java
public class SomeClass {
}
new SomeClass(); // works
public class SomeClass {
public SomeClass(Strng name) {}
View StreamWriteSizeDemo.java
package com.qozix.crypto;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
View StartTournamentActivity.java
package edu.gatech.seclass.tourneymanager;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import java.util.ArrayList;
import java.util.HashSet;
View downloads.md

Queue Downloading

Tern Downloading

  1. Fetch book meta: https://www.safaribooksonline.com/api/v1/book/9780132808200/, and create a directory for that book using the book id: 9780132808200

  2. Fetch all chapter meta. Get the chapters field from the book meta json, which looks like this:

     "chapters": [
         "https://www.safaribooksonline.com/api/v1/book/9780132808200/chapter/cover.html",
    
View SampleMediaCollection.md

so a MediaCollection (or any ContentCollection) has a List.
The ContentElement interface will have a save method, that takes some reference to a database or database helper, and the implementation will take care of saving:

void Chapter.save(Database db) {
  Values values = new Values();
  // populate values with information
  db.insertOrUpdate(CHAPTERS_TABLE).values(values);
}
...
View Actor
package com.qozix.messages;
/**
* Created by michaeldunn on 8/8/16.
*/
public abstract class Actor<T> {
public abstract void react(T t);
@SuppressWarnings("unchecked")
void translateAndReact(Object object) {
react((T) object);
View MessageBus
package com.qozix.messages;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* Created by michaeldunn on 8/8/16.
*/
View CompositeCallback
public class CompositeCallback<T> implements Callback<T> {
private List<Callback<T>> mCallbacks = new LinkedList<>();
public CompositeCallback(Callback<T> callback) {
add(callback);
}
public CompositeCallback<T> add(Callback<T> callback) {
if (callback != null) {
mCallbacks.add(callback);
View SteakKnife.java
package example.viewcontrollers;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@moagrius
moagrius / attrs.xml
Created Jul 1, 2016
Use this to gather custom XML attributes for CenterContainViewGroup
View attrs.xml
<resources>
<declare-styleable name="CenterContainViewGroup">
<attr name="natural_width" format="integer" />
<attr name="natural_height" format="integer" />
</declare-styleable>
</resources>
You can’t perform that action at this time.