Skip to content

Instantly share code, notes, and snippets.

View ishmaelmakitla's full-sized avatar

Ishmael Makitla ishmaelmakitla

View GitHub Profile
package <package-name-here>
/**
* This is just a dummy listener to make a point - the inner class constructor uses interface as a type of its argument.
* */
public interface DummyToastListener {
public void onToastValue(double value);
}
StringRequest putRequest = new StringRequest(Request.Method.PUT, url,
new Response.Listener<String>()
{
@Override
public void onResponse(String response) {
delegate.postNotificationSucced();
}
},
new Response.ErrorListener()
{
package <your-package-name>
import com.google.gson.Gson;
public class LastKnownUserPosition {
private double latitude;
private double longitude;
public LastKnownUserPosition(){
package <your package>;
import java.util.ArrayList;
import org.json.JSONException;
import org.json.JSONObject;
import za.co.smartcitizens.trafficlights.spotter.models.LastKnownUserPosition;
import za.co.smartcitizens.trafficlights.spotter.models.TrafficLightIntersectionGeofence;
import android.content.Context;
package ishmael.academia.examples.tut.dpc401t;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
package za.co.smartcitizens.trafficlights.spotter.utils;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import org.apache.http.HttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
package za.co.pta.gdg.hashcode.delivery;
import java.io.BufferedReader;
import java.io.FileReader;
public class DeliveryCommandProcessor {
//rows
int rows;
int columns;
//number of drones
@ishmaelmakitla
ishmaelmakitla / RightAngleHashCodePracticeApp.java
Created February 11, 2016 08:10
This is the code for painting the Right Angle Hash Code 2016 Practice Problem using 107 commands. You are welcome to make improvements and reduce the number of commands used.
package za.co.pta.gdg.hashcode.practice;
/**
* This code paints the Right Angle Hash Code Practice problem using 107 commands.
* It makes use of the HashCodeCommandProcessor - see this gist: https://gist.github.com/ishmaelmakitla/920632ae6c35805d9aa3
*
* */
public class RightAngleHashCodePracticeApp {
/**
* Right Angle Practice
package za.co.pta.gdg.hashcode.practice;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* This is a utility class for processing Paint Commands
*
@ishmaelmakitla
ishmaelmakitla / FileDownloadRequest.java
Last active August 29, 2015 14:21
This Gist shows how the Volley Request<T> class can be extended to support file download. The response listener will receive a File through the callback method onResponse(File downloadedFile). The file will already be on the device at this point.
package za.org.pta.gdg.gists;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Date;
import android.content.Context;
import android.os.Environment;
import android.util.Log;