Skip to content

Instantly share code, notes, and snippets.

View nohe427's full-sized avatar
💾
Saving...

Alexander Nohe nohe427

💾
Saving...
View GitHub Profile
@nohe427
nohe427 / mapps.html
Created December 11, 2013 16:29
Lines 1654 to 1676 in the mapps.html. The alert window allows the user to know that writing a review has been disabled.
function submitReviewDialog()
{
// We're done with getting the review
hideReviewDialog();
// Submit the comment
/*dojo.xhrPost({
url: "proxy.ashx?http://www.arcgis.com/sharing/content/items/" + currentDetailsId + "/addComment",
headers: {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"},
postData:
function sanitize(encodedString)
{
var str = encodedString;
var message = str.replace(/%3C/gi, "&lt;"); //This one replaces < with &lt
var message = message.replace(/%3E/gi, "&gt;"); //This one replaces > with &gt
var message = message.replace(/%2F/gi, "&frasl;"); //This replaces the / sign with &frasl
var message = message.replace(/%3B/gi, ";"); //This one allows ; to be decoded
var message = message.replace(/</gi, "&lt;"); //This prevents nonencoded < to be used as &lt
var message = message.replace(/>/gi, "&gt;"); //This prevents nonecoded > to be used as &gt
var message = message.replace(/%26/gi, "&amp;"); //This one decodes & to &amp
@nohe427
nohe427 / basemapGen.js
Created May 9, 2014 15:31
Random Basemap Generator. This generates a random basemap for use in the ArcGIS JavaScript API.
function mapSelect(){
var mapOptions = ["osm", "national-geographic", "gray", "satellite", "hybrid", "oceans", "streets", "topo"];
num = Math.floor(Math.random() * mapOptions.length);
console.log(num)
basemap = mapOptions[num];
console.log(basemap)
return basemap;
};
@nohe427
nohe427 / recordTrigger.php
Last active August 29, 2015 14:01
Add Json Data to
<?php
ini_set('display_errors',1);
error_reporting(E_ALL & ~E_NOTICE);
//Attempt to Connect
$connection = @mysql_connect ('localhost', 'root', 'nohe');
@mysql_select_db("Noah", $connection);
@nohe427
nohe427 / rand.py
Created May 30, 2014 14:24
uniqueRandomNumbers
import random
L = [0]
def nohe(x):
global L
x = 0
while x in L:
x = random.choice(range(1, 361))
L.append(x)
return x
@nohe427
nohe427 / downloadZipArcGIS.py
Created November 25, 2014 17:39
downloadZipFilesFrom ArcGIS Online
import requests
urlToGoTo = 'URLOfServiceOnAGOL'
r = requests.get(urlToGoTo, allow_redirects=True)
with open(r"FileLocation.ZIP", "wb") as f:
for chunk in r.iter_content():
f.write(chunk)
void Button1Click(object sender, EventArgs e)
{
string name;
name = textBox1.Text;
string pigName = "";
makePigLatin(ref pigName, name);
label1.Text = pigName;
}
public void makePigLatin(ref string pigName, string name)
@nohe427
nohe427 / SampleTBX.pyt
Created March 30, 2015 15:51
This is a sample filter for a long data type in Python.
import arcpy
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "ToolboxSample"
self.alias = "ToolboxSample"
//
// main.cpp
// Lesson9-1
//
// Created by Alexander Nohe on 8/4/15.
// Copyright (c) 2015 Alexander Nohe. All rights reserved.
//
#include <iostream>
#include <fstream>
@nohe427
nohe427 / getUsers.py
Created August 26, 2015 18:01
This gets all users in an ArcGIS Online organization
import urllib
import urllib2
import json
class ArcGISOnline(object):
def __init__(self, Username, Password):
self.username = Username
self.password = Password
self.__token = self.generateToken(self.username, self.password)['token']