Skip to content

Instantly share code, notes, and snippets.

View ViewController.swift
//
// ViewController.swift
// CorePlotTest
//
// Created by Al Wold on 8/6/14.
// Copyright (c) 2014 Al Wold. All rights reserved.
//
import UIKit
View data.swift
func numberOfRecordsForPlot(plot: CPTPlot!) -> UInt {
return 4
}
func numberForPlot(plot: CPTPlot!, field fieldEnum: UInt, recordIndex idx: UInt) -> NSNumber! {
return idx+1
}
View graph.swift
// create graph
var graph = CPTXYGraph(frame: CGRectZero)
graph.title = "Hello Graph"
graph.paddingLeft = 0
graph.paddingTop = 0
graph.paddingRight = 0
graph.paddingBottom = 0
// hide the axes
var axes = graph.axisSet as CPTXYAxisSet
var lineStyle = CPTMutableLineStyle()
View styles.xml
<resources>
<style name="FindMyTrain" parent="Theme.Sherlock">
<item name="android:actionBarStyle">@style/FindMyTrain.ActionBar</item>
<item name="actionBarStyle">@style/FindMyTrain.ActionBar</item>
<item name="android:actionBarTabStyle">@style/FindMyTrain.ActionBar.Tab</item>
<item name="actionBarTabStyle">@style/FindMyTrain.ActionBar.Tab</item>
</style>
<style name="FindMyTrain.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/action_bar_background</item>
View request-sample-modified.txt
GET /mobile/api/v1/menu.json HTTP/1.1
User-Agent: asu-mobile/1.0
Host: www.asu.edu
Accept: application/json
If-Modified-Since: Fri, 28 Mar 2014 16:51:43 GMT
HTTP/1.1 200 OK
Date: Fri, 28 Mar 2014 16:57:04 GMT
Last-Modified: Fri, 28 Mar 2014 16:45:00 GMT
Content-Length: xxx
View request-sample-not-modified.txt
GET /mobile/api/v1/menu.json HTTP/1.1
User-Agent: asu-mobile/1.0
Host: www.asu.edu
Accept: application/json
If-Modified-Since: Fri, 28 Mar 2014 16:51:43 GMT
HTTP/1.1 304 Not Modified
Date: Fri, 28 Mar 2014 16:54:25 GMT
View error.json
{
"status": "error",
"code": 123,
"message": "A database error has occurred"
}
View menu.json
{
"status": "ok",
"menu": [
{
"order": 1,
"icon": "http://www.asu.edu/mobile/images/icon1.png",
"icon-background-position": "0 -50px",
"title": "My ASU",
"subtitle": "INFO",
"url": "https://my.asu.edu",
View ClassesResource.java
package com.example;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
View AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/FindMyTrain"
android:name=".FindMyTrainApplication" >