Skip to content

Instantly share code, notes, and snippets.

View dmozzy's full-sized avatar

Daniel Moscufo dmozzy

  • Perth, Western Australia
View GitHub Profile
@dmozzy
dmozzy / Locations.html
Created April 11, 2012 14:01
GeoTaskList tutorial #3 Locations.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>GeoTaskList</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" />
<script src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry" type="text/javascript"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
@dmozzy
dmozzy / core.clj
Created April 10, 2012 13:35
Blog #3 Routing changes
(GET "/tasks" []
(json-response {:tasks (get-all-tasks)}))
(POST "/task" {params :params}
(json-response {:taskId (persist/save-task params)}))
@dmozzy
dmozzy / persistence.clj
Created April 10, 2012 13:34
Blog #3 Task persistence changes
;Gets a map of locations keyed by the locationId value
(defn get-all-locations-map []
(let [loaded-locations
(get-all-locations)]
(zipmap (map (fn [k] (:locationId k)) loaded-locations) loaded-locations)))
(defn save-task [task-map]
(let [input-id (Integer/parseInt (:taskId task-map))
@dmozzy
dmozzy / Defentity.clj
Created March 16, 2012 14:37
Location Entity Definition
(ds/defentity Location [^:key locationId, ^:clj location])
@dmozzy
dmozzy / Locations.html
Created March 15, 2012 15:02
GeoTaskList tutorial #2 Locations.html
<!-- Follow the blog posts for this code here: http://www.digitalbricklayers.com/2012/03/geotasklist-part-2.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>GeoTaskList</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" />
<script src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry" type="text/javascript"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
@dmozzy
dmozzy / core.clj
Created March 15, 2012 15:02
GeoTaskList tutorial #2 core.clj
;Follow the blog posts for this code here: http://www.digitalbricklayers.com/2012/03/geotasklist-part-2.html
(ns GeoTaskList.core
(:require [appengine-magic.core :as ae]
[compojure.route :as route])
(:use [compojure.core]
[cheshire.core :as json]
[ring.util.response :as ring-response]
[compojure.handler :as comp-handler]
[GeoTaskList.persistence :as persist]))
@dmozzy
dmozzy / locations.json
Created March 11, 2012 09:29
Locations json ouput
{"locations":[{"lng":115.931422,"name":"Hardware","lat":-31.957242},{"lng":115.935241,"name":"Mall","lat":-31.964779}]}
@dmozzy
dmozzy / Locations.html
Created March 11, 2012 07:38
GeoTaskList Tutorial #1 Locations.html
<!-- Read the blog post on this gist here http://www.digitalbricklayers.com/2012/03/geotasklist-in-jquery-mobile-and.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>GeoTaskList</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" />
<script src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry" type="text/javascript"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
@dmozzy
dmozzy / core.clj
Created March 11, 2012 07:37
GeoTaskList tutorial #1 core.clj
;Read the blog post on this gist here http://www.digitalbricklayers.com/2012/03/geotasklist-in-jquery-mobile-and.htm
(ns GeoTaskList.core
(:require [appengine-magic.core :as ae]
[compojure.route :as route])
(:use [compojure.core]
[cheshire.core :as json]
[ring.util.response :as ring-response]))
(defn json-response [data & [status]]
{:status (or status 200)
@dmozzy
dmozzy / persistence.clj
Created March 8, 2012 14:50
GeoTaskList tutorial #2 Appengine Persistence
;Follow the blog posts for this code here: http://www.digitalbricklayers.com/2012/03/geotasklist-part-2.html
(ns GeoTaskList.persistence
(:require [appengine-magic.services.datastore :as ds]))
(ds/defentity Location [^:key locationId, ^:clj location])
;Save a location. -1 is used to signify no id passed in and nil
;should be substitued
(defn save-location [location-map]