Skip to content

Instantly share code, notes, and snippets.

View doneill's full-sized avatar
🏔️

Dan O'Neill doneill

🏔️
View GitHub Profile
@doneill
doneill / setjdk.sh
Last active May 30, 2018 21:12
Switch Java SDK's
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
export PATH=$JAVA_HOME/bin:$PATH
fi
}
@doneill
doneill / VollyPost.java
Created February 13, 2018 22:57
Post request using Volley
final double lat = latlng.latitude;
final double lon = latlng.longitude;
String url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&key=API_KEY";
RequestQueue requestQueue= Volley.newRequestQueue(getContext());
StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
//This code is executed if the server responds, whether or not the response contains data.
//The String 'response' contains the server's response.
@doneill
doneill / runDebugApp.sh
Last active June 8, 2018 17:47
Run an Android app from terminal prompt
# run android app
# usage runDebugApp [module] [fully qualified start activity com.package/com.package.MainActivity]
function runDebugApp(){
./gradlew -offline :"$1":installDebug && adb shell am start "$2" && adb logcat -d > logcat.log && terminal-notifier -message 'runDebugApp Done!'
}
@doneill
doneill / javasdk.sh
Created October 5, 2017 18:38
Manage Java SDK's from path
# manage jdk's
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
export PATH=$JAVA_HOME/bin:$PATH
fi
@doneill
doneill / GetSubLayerInfos.java
Created October 5, 2017 18:36
Example of loading sublayer
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create a map with the Basemap Type topographic
final ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 48.354406, -99.998267, 2);
// create a MapImageLayer with dynamically generated map images
mMapImageLayer = new ArcGISMapImageLayer(getResources().getString(R.string.highway));
mMapImageLayer.loadAsync();
mMapImageLayer.addDoneLoadingListener(new Runnable() {
@Override
@doneill
doneill / RuntimePermissions.kt
Created August 4, 2017 00:42
Kotlin Runtime Permissions
// define permission to request
private val reqPermission = arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE)
// For API level 23+ request permission at runtime
val reqPermission = arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE)
val requestCode = 2
if (ContextCompat.checkSelfPermission(this, reqPermission[0]) == PackageManager.PERMISSION_GRANTED) {
// run fun
} else {
ActivityCompat.requestPermissions(this, reqPermission, requestCode)
@doneill
doneill / ImmutablePart.java
Created February 18, 2017 05:44
Test immutable parts in Android SDK
// inflate MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// create an ArcGISMap with BasemapType topo
final ArcGISMap map = new ArcGISMap(Basemap.Type.DARK_GRAY_CANVAS_VECTOR, 65.783988, -83.447820, 6);
pointCollectionOne = new PointCollection(SpatialReference.create(102113));
pointCollectionOne.add(-9080995.6424, 9910570.681900002);
pointCollectionOne.add(-9349175.207599999, 9361330.556400001);
pointCollectionOne.add(-9236116.532600001, 10398421.5554);
@doneill
doneill / alpental.geojson
Last active January 31, 2017 22:37
Alpental Features
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@doneill
doneill / pom.xml
Created January 19, 2017 23:45
ArcGIS Java Maven configuration
<project>
<!-- Project configuration... -->
<repositories>
<repository>
<id>esri-arcgis</id>
<url>https://esri.bintray.com/arcgis</url>
</repository>
</repositories>
<pluginRepositories>
@doneill
doneill / adb.sh
Created November 23, 2016 21:39
Android adb commands
# you will find some related property for check the device is 32bit or 64bit
# ro.product.cpu.abilist32
# ro.product.cpu.abilist64
# ro.product.cpu.abilist
# getprop is an android utility to retrieve a property via the android property service.
adb shell getprop
# ro.product.cpu.abi is android property, this property could help you confirm this device is ARM or Intel x86
adb shell getprop ro.product.cpu.abi