Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Code fairy was here

  • Loading branch information...
commit 33f0ef925619f05ab71626642fc9e686ae828914 1 parent 34ba972
@peritus authored
View
4 setup.py
@@ -24,7 +24,7 @@ def runcmd(command, env=None):
if get_platform().startswith('macosx'):
from os import chmod
import stat
-
+
# Remove PPC compilation if using Xcode 4.
xc_path = "/usr/bin/xcodebuild"
if os.path.exists(xc_path):
@@ -33,7 +33,7 @@ def runcmd(command, env=None):
version_number = version.split()[1]
if StrictVersion(version_number) >= StrictVersion('4.0'):
os.environ['ARCHFLAGS'] = '-arch i386 -arch x86_64'
-
+
class install_data(_install_data):
'''
On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../
View
122 src/chrome-ext/geocommit-visualize.js
@@ -9,93 +9,93 @@
// ==/UserScript==
function getGeocommitLink() {
- return '<a href="http://www.geocommit.com" title="geocommit">geocommit</a>';
+ return '<a href="http://www.geocommit.com" title="geocommit">geocommit</a>';
}
function getMapHtml(point, width, height, style) {
- if (style) {
- style = 'style="' + style + '" ';
- }
- else {
- style = '';
- }
-
- return '<a href="http://maps.google.com/maps?q=' + point +
- '" title="geocommit location"><img ' + style +
- 'src="http://maps.google.com/maps/api/staticmap?center=' + point +
- '&zoom=14&size=' + width + 'x' + height +
- '&format=png&sensor=false&markers=' + point +
- '"/></a>';
+ if (style) {
+ style = 'style="' + style + '" ';
+ }
+ else {
+ style = '';
+ }
+
+ return '<a href="http://maps.google.com/maps?q=' + point +
+ '" title="geocommit location"><img ' + style +
+ 'src="http://maps.google.com/maps/api/staticmap?center=' + point +
+ '&zoom=14&size=' + width + 'x' + height +
+ '&format=png&sensor=false&markers=' + point +
+ '"/></a>';
}
function geocommitVisualize() {
- var data = {};
+ var data = {};
- // github
- if ($('#gitnotes-content').length) {
+ // github
+ if ($('#gitnotes-content').length) {
- $('#gitnotes-content').find('h3').each(function(i, el) {
- if ('geocommit' !== $(el).text() && 'geogit' !== $(el).text()) {
- return;
- }
+ $('#gitnotes-content').find('h3').each(function(i, el) {
+ if ('geocommit' !== $(el).text() && 'geogit' !== $(el).text()) {
+ return;
+ }
- var geostr = $(el).next().text().substr('geocommit (1.0)\n'.length);;
- var kwblob = geostr.split('\n');
+ var geostr = $(el).next().text().substr('geocommit (1.0)\n'.length);
+ var kwblob = geostr.split('\n');
- $(kwblob).each(function(i, line) {
- if (! line) {
- return;
- }
- var d = line.split(": ");
+ $(kwblob).each(function(i, line) {
+ if (! line) {
+ return;
+ }
+ var d = line.split(': ');
- data[d[0]] = d[1];
- });
+ data[d[0]] = d[1];
+ });
- $(el).next().text(geostr)
- $(el).next().prepend(getGeocommitLink() + ' location: \n');
+ $(el).next().text(geostr);
+ $(el).next().prepend(getGeocommitLink() + ' location: \n');
- });
+ });
- var point = (data.Latitute || data.lat) + ',' + (data.Longitude || data.long);
+ var point = (data.Latitute || data.lat) + ',' + (data.Longitude || data.long);
- $('#commit div.group div.envelope div.machine').append(
- '<div style="padding-top:15px;background-color: #eaf2f5;' +
+ $('#commit div.group div.envelope div.machine').append(
+ '<div style="padding-top:15px;background-color: #eaf2f5;' +
'margin-left:-125px;">' + getMapHtml(point, 320, 200, null) +
'</div>'
- );
- }
- // bitbucket
- else if ($('#source-summary').length) {
+ );
+ }
+// bitbucket
+ else if ($('#source-summary').length) {
- $('#source-summary').find('p').each(function(i, el) {
- if (!$(el).text().match('^geocommit')) {
- return;
- }
+ $('#source-summary').find('p').each(function(i, el) {
+ if (!$(el).text().match('^geocommit')) {
+ return;
+ }
- var geostr = $(el).text().substr('geocommit(1.0): '.length);
- var kwblob = geostr.split(', ');
+ var geostr = $(el).text().substr('geocommit(1.0): '.length);
+ var kwblob = geostr.split(', ');
- $(kwblob).each(function(i, keyval) {
- if (! keyval) {
- return;
- }
- var d = keyval.split(" ");
+ $(kwblob).each(function(i, keyval) {
+ if (! keyval) {
+ return;
+ }
+ var d = keyval.split(' ');
- data[d[0]] = d[1];
- });
+ data[d[0]] = d[1];
+ });
- $(el).text(geostr);
- $(el).prepend(getGeocommitLink() + ' location: ');
+ $(el).text(geostr);
+ $(el).prepend(getGeocommitLink() + ' location: ');
- });
+ });
- var point = data.lat + ',' + data.long;
+ var point = data.lat + ',' + data.long;
- $('#source-summary dl.relations').append(
- '<dt>location</dt><dd>' + getMapHtml(point, 256, 192, null) + '</dd>'
- );
- }
+ $('#source-summary dl.relations').append(
+ '<dt>location</dt><dd>' + getMapHtml(point, 256, 192, null) + '</dd>'
+ );
+ }
}
geocommitVisualize();
View
34 src/chrome-ext/manifest.json
@@ -1,14 +1,24 @@
{
- "update_url":"http://clients2.google.com/service/update2/crx",
- "name": "Geocommit",
- "version": "0.9.2",
- "description": "This script visualizes geocommits on github and bitbucket",
- "browser_action": {
- "default_icon": "geocommit_chromeext_logo.png"
- },
- "content_scripts": [{
- "run_at": "document_idle",
- "js": [ "jquery.min.js", "geocommit-visualize.js" ],
- "matches": [ "http://bitbucket.org/*", "https://bitbucket.org/*", "https://github.com/*", "http://www.github.com/*" ]
- }]
+ "browser_action": {
+ "default_icon": "geocommit_chromeext_logo.png"
+ },
+ "content_scripts": [
+ {
+ "js": [
+ "jquery.min.js",
+ "geocommit-visualize.js"
+ ],
+ "matches": [
+ "http://bitbucket.org/*",
+ "https://bitbucket.org/*",
+ "https://github.com/*",
+ "http://www.github.com/*"
+ ],
+ "run_at": "document_idle"
+ }
+ ],
+ "description": "This script visualizes geocommits on github and bitbucket",
+ "name": "Geocommit",
+ "update_url": "http://clients2.google.com/service/update2/crx",
+ "version": "0.9.2"
}
View
1  src/geocommit/__init__.py
@@ -302,4 +302,3 @@ def git_geo():
usage()
sys.exit(1)
-
View
1  src/geocommit/location.py
@@ -103,4 +103,3 @@ def from_short_format(data):
setattr(l, key, data[key])
return l
-
View
1  src/geocommit/locationprovider.py
@@ -21,4 +21,3 @@ def new():
else:
from geocommit.networkmanager import NetworkManager
return NetworkManager()
-
View
1  src/geocommit/networkmanager.py
@@ -108,4 +108,3 @@ def get_access_points(self):
except ImportError:
pass # no dbus available on this system
-
View
9 src/geocommit/provider/corelocation/__init__.py
@@ -19,14 +19,14 @@
class CoreLocationProvider(LocationProvider):
def location_from_dict(self, data):
""" Converts JSON response into a location object
-
+
>>> clp = CoreLocationProvider()
>>> clp.location_from_dict({"latitude":1.2, "longitude":3.4}).format_geocommit(" ", ", ")
'lat 1.2, long 3.4, src cl'
"""
if not data or not isinstance(data, dict) or not data.get('latitude') or not data.get('longitude'):
return None
-
+
location = Location(data['latitude'], data['longitude'], src='cl')
optional_keys = {
'altitude': 'alt',
@@ -39,16 +39,15 @@ def location_from_dict(self, data):
if data.has_key(json_key):
setattr(location, loc_key, data[json_key])
return location
-
+
def get_location(self):
ret, value = system_exit_code(EXECUTABLE)
if ret != 0:
return None
-
+
try:
parsed_value = json.loads(value)
return self.location_from_dict(parsed_value)
except ValueError as e:
return None
return None
-
View
1  src/geocommit/wifilocationprovider.py
@@ -116,4 +116,3 @@ def get_location(self):
self.access_token = location["access_token"]
return self.location_from_dict(location)
-
Please sign in to comment.
Something went wrong with that request. Please try again.