Skip to content

Instantly share code, notes, and snippets.

View phpmaps's full-sized avatar
💭
Lending a helping hand on the web.

Doug Carroll phpmaps

💭
Lending a helping hand on the web.
View GitHub Profile
@phpmaps
phpmaps / gist:5486865
Created April 30, 2013 06:13
Connect to mysql
mysql -h localhost -u myname -p mypass mydb
@phpmaps
phpmaps / gist:5511762
Created May 3, 2013 17:37
Handle sticky popup form code review
require([
"loqi/map",
"loqi/Pin",
"loqi/Popup",
"loqi/Symbols",
"dojo/query",
"dojo/on",
"dojo/dom-form",
"dojo/dom-construct",
"dojo/_base/event",
@phpmaps
phpmaps / gist:5674308
Created May 29, 2013 22:20
OAuth workflow using ArcGIS API for JavaScript
dojo.require("esri.arcgis.Portal");
dojo.require("app.OAuthHelper");
dojo.ready(initialize);
function initialize() {
OAuthHelper.init({
appId: "q244Lb8gDRgWQ8hM",
portal: "http://www.arcgis.com",
expiration: (14 * 24 * 60), // 2 weeks, in minutes
@phpmaps
phpmaps / gist:5699732
Created June 3, 2013 17:24
Android polling example which gets triggered every 10 seconds.
protected void getLocationPeriodically() {
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
Location l = (Location) msg.obj;
Toast.makeText(getApplicationContext(), "Latitude: " + String.valueOf(l.getLatitude()) + " Longitude: " + String.valueOf(l.getLongitude()),
Toast.LENGTH_LONG).show();
}
};
new Thread(new Runnable() {
// Three things to note in the signature:
// - The method has an async modifier.
// - The return type is Task or Task<T>. (See "Return Types" section.)
// Here, it is Task<int> because the return statement returns an integer.
// - The method name ends in "Async."
async Task<int> AccessTheWebAsync()
{
// You need to add a reference to System.Net.Http to declare client.
HttpClient client = new HttpClient();
@phpmaps
phpmaps / gist:6175939
Created August 7, 2013 16:54
Map data / service in WGS84 coordinate system.
http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer
@phpmaps
phpmaps / agol_trigger
Created October 3, 2013 08:16
Create new geotrigger via Agol
curl -H "Content-Type: application/json" -H "Authorization: Bearer MdvA0hAw5s45Hdpqr-BfpohFgRzTSlMVkqJ1AFFK6GYzYSThVv3YMi4_nPxHq_ydKDTSNXz5VEGY_5CibpNOlpHJccOf2s-9bXSMPKMqP04fGlHTcGDpFNlSg914ZRQydsV94kjcrhOQmgkyTEDc0Q.." -X POST -d '{"condition": {"direction": "enter","geo": {"latitude": 45.5165,"longitude": -122.6764,"distance": 240}},"action": {"notification": {"text": "Welcome to Doogsland"}}}' https://geotrigger.arcgis.com/trigger/create
@phpmaps
phpmaps / gist:7611348
Created November 23, 2013 06:03
PHP helpers
public function makeDirectory($dir, $mode = 0666) //Not implemented.
{
if (is_dir($dir) || @mkdir($dir,$mode)) return true;
if (!$this->makeDirectory(dirname($dir),$mode)) return false;
return @mkdir($dir,$mode);
}
@phpmaps
phpmaps / gist:7652937
Created November 26, 2013 03:10
Secure Proxy Test with GIS Date from ArcGIS Online
http://localhost/sproxy/dev/auth_proxy.php?https://geoenrich.arcgis.com/arcgis/rest/services/World/geoenrichmentserver/Geoenrichment/dataCollections/?f=pjson
@phpmaps
phpmaps / gist:7654045
Created November 26, 2013 05:59
GeoEnriched Reports with ArcGIS Online
http://localhost/sproxy/dev/auth_proxy.php?http://geoenrich.arcgis.com/arcgis/rest/services/World/MapServer/exts/BAServer/Geoenrichment/Reports/United%20States?f=pjson