Skip to content

Instantly share code, notes, and snippets.

@blangel
blangel / gist:7530868
Created November 18, 2013 16:32
LocationService onCreate
this.looper - new AtomicReference<Looper>();
this.thread = new Thread(new Runnable() {
@Override public void run() {
Looper.prepare();
LocationService.this.looper.set(Looper.myLooper());
handler = new Handler(Looper.myLooper());
Looper.loop();
}
}, "Dash-Location-Looper");
this.thread.start();
// The GeoQueryRequest will contain the inputted QueryRequest (decorated with geo-hash/etc)
// as well as a QueryResultGeoFilter to post process the results
GeoQueryRequst geoQueryRequest = geo.radiusQuery(QueryRequest request, double latitude, double longitude, double radius, Config config);
QueryRequest queryRequest = geoQueryRequest.queryRequest;
// clients will use GeoQueryRequest in a manner similar to the following
List<Map<String, AttributeValue>> resultItems = new ArrayList<Map<String, AttributeValue>>((limit < 1000 ? limit : 1000));
do {
try {
queryResult = ddb.query(queryRequest);
@blangel
blangel / Overloading Method Tests.facil.java
Last active December 30, 2015 19:51
Overloading Test Methods
test ClassToTest {
methodToTest() {
// testing method named 'methodToTest' on class ClassToTest which takes 0 arguments
}
methodToTest(String) {
// testing overloaded method named 'methodToTest' on class ClassToTest which takes 1 argument of type String
}
// note, there is no restriction one must organize code in this way, this exists to allow programmers to more neatly organize their test methods
}
@blangel
blangel / AccessTokenRequest.json
Last active October 3, 2018 14:44
Dash Fleet API - AccessTokenRequest Example JSON
{"grant_type":"password",
"client_id":"CLIENT_ID",
"username":"USER_USERNAME",
"password":"USER_PASSWORD",
"provider":"Dash"}
@blangel
blangel / AccessToken.json
Last active October 2, 2018 14:50
Dash Fleet API - AccessToken Example JSON
{"access_token":"kdjfdMkjdkfjf2o2kj2kjfjkdjk@111gi3i3b32"}
@blangel
blangel / PasswordResetRequest.json
Created October 2, 2018 13:02
Dash Fleet API - PasswordResetRequest Example JSON
{"userId":"USER_EMAIL"}
@blangel
blangel / PasswordResetFromCodeRequest.json
Last active October 3, 2018 14:45
Dash Fleet API - PasswordResetFromCodeRequest Example JSON
{"userId":"USER_EMAIL",
"code":"RESET_CODE",
"password":"NEW_PASSWORD"}
@blangel
blangel / PasswordResetFromAuthRequest.json
Last active October 3, 2018 14:45
Dash Fleet API - PasswordResetFromAuthRequest Example JSON
{"oldPassword":"OLD_PASSWORD",
"password":"NEW_PASSWORD"}
@blangel
blangel / RegistrationRequest.json
Last active October 3, 2018 14:46
Dash Fleet API - RegistrationRequest Example JSON
{"name":"USER_FULL_NAME",
"email":"USER_EMAIL",
"password":"USER_PASSWORD",
"timeZoneId":"USER_TIME_ZONE_ID",
"localeId":"USER_LOCALE_ID"}
@blangel
blangel / JavascriptTimeZoneId.js
Created October 2, 2018 14:27
JavaScript TimeZone Id
Intl.DateTimeFormat().resolvedOptions().timeZone