Skip to content

Instantly share code, notes, and snippets.

@flbuddymooreiv
flbuddymooreiv / logicalxmldiff.md
Last active November 21, 2018 22:18
Logical XML Diff

If you need to compare two XML documents, but certain elements are not in the same order between the two documents, and order of elements does not matter (i.e. the elements contain collections rather than lists), here is a nice way to do it.

Consider the following files:

user@host:~/xmldiff$ cat a.xml
<?xml version="1.0"?>
<Element xmlns="https://mynamespace.com/path">
  <SubElement>
    <Items>
 
@danasilver
danasilver / citystategeo.js
Created July 17, 2013 20:11
Get only city and state from Google Maps API Reverse Geocoder
if (window.navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude,
lng = position.coords.longitude,
latlng = new google.maps.LatLng(lat, lng),
geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
for (var i = 0; i < results.length; i++) {