Skip to content

Instantly share code, notes, and snippets.

View skroged's full-sized avatar

Josh Jones skroged

View GitHub Profile
@skroged
skroged / idsentence.py
Created July 20, 2017 16:43 — forked from prschmid/idsentence.py
Implement a memorable ID string. The original idea for this comes from Asana where it is documented on their blog: http://blog.asana.com/2011/09/6-sad-squid-snuggle-softly/
"""Implement a memorable ID string.
The original idea for this comes from Asana where it is documented on their
blog:
http://blog.asana.com/2011/09/6-sad-squid-snuggle-softly/
There are other partial implementations of this and can be found here:
Node.js: https://github.com/linus/greg
Java: https://github.com/PerWiklander/IdentifierSentence
@skroged
skroged / ClicksContentProvider.java
Created September 26, 2014 22:04
serial query runnable
public static void query(QueryListener cursorListener, Context context,
Uri uri, String[] cols, String[] selectionArgs,
String selection, String sortOrder) {
new Thread(new QueryRunnable(cursorListener, context,
uri, cols, selectionArgs,
selection, sortOrder)).start();
}
private static class QueryRunnable implements Runnable {
@skroged
skroged / ClicksService.java
Created September 23, 2014 20:22
cleaner locks
public class ClicksService extends IntentService {
private static final String TAG = ClicksService.class.getSimpleName();
public ClicksService(String name) {
super(name);
}
public ClicksService() {
super("ClicksService");
@skroged
skroged / ClicksService.java
Last active August 29, 2015 14:06
serializing tasks
public class ClicksService extends IntentService {
private static final String TAG = ClicksService.class.getSimpleName();
final Object locker = new Object();
public ClicksService(String name) {
super(name);
}
@skroged
skroged / InboxHelperTest.java
Created July 21, 2014 18:42
how do I test?
public void testSendMessage() throws Exception {
CIUser user = new CIUser();
user.setDirectAddress("ADDRESS");
List<CIUser> toList = new ArrayList<CIUser>();
toList.add(user);
String subject = "SUBJECT";
String messageText = "MESSAGE";
Random r = new Random();
int forwardId = r.nextInt();
@skroged
skroged / InboxHelper.java
Created June 6, 2014 17:43
volley example
Response.Listener<JSONObject> responseListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(final JSONObject response) {
}
};
Response.ErrorListener errorListener = new Response.ErrorListener() {