This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import webapp2 | |
| class ServerTime(webapp2.RequestHandler): | |
| def get(self): | |
| self.response.headers["Content-Type"] = "application/json" | |
| #self.response.headers.add_header("Access-Control-Allow-Origin", "*") | |
| response = {"message": "Hello AJAX!"} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var dataToSend = {}; | |
| $.post( "/servertime", dataToSend ).done(function( data ) { | |
| console.log("Response JSON: " + JSON.stringify(data)); | |
| // TODO: Do something with the data | |
| }).fail(function(jqxhr, textStatus, error) { | |
| console.log("POST Request Failed: " + textStatus + ", " + error); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.getJSON("/servertime").done(function(json) { | |
| console.log("JSON Data: " + JSON.stringify(json)); | |
| // TODO: Do something with the JSON data. | |
| }).fail(function(jqxhr, textStatus, error) { | |
| console.log("GET JSON Request Failed: " + textStatus + ", " + error); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| js_track.append(("Simple AJAX Requests - Server Time", False, "/static/SimpleAjax/ServerTime/server_time.html")) | |
| js_track.append(("Simple AJAX Requests - MovieQuotes Quiz", False, "http://" + USERNAME + "-movie-quotes.appspot.com/quiz.html")) | |
| js_track.append(("Simple AJAX Requests - Tic-Tac-Toe Lab", False, "http://" + USERNAME + "-ttt.appspot.com/matching.html")) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class TouchesAndViewsViewController: UIViewController { | |
| @IBOutlet weak var logoImageView: UIImageView! | |
| override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { | |
| if let touch = touches.first { | |
| let position = touch.location(in: view) | |
| print(position) | |
| UIView.beginAnimations(nil, context: nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class StudentTableViewController: UITableViewController { | |
| let students = ["Nick", "Trevor", "Joseph", "Ruying", "Zhiyang", "Chris", "Jonathan", "Matt", "Tayler", "Jonathan", "Matt", "Jonathan", "Haolin", "Anthony", "Tianjiao", "Chris", "Bo", "Ashok", "Philip", "Grant", "Ishank", "Stephen", "Benedict", "Xiangqing"] | |
| override func numberOfSections(in tableView: UITableView) -> Int { | |
| return 1 | |
| } | |
| override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class ViewController: UIViewController { | |
| // Interface Builder Connections redacted | |
| var roundNumber = 1 | |
| var playerScores = [0, 0, 0, 0] | |
| var scoreTextFields = [UITextField]() | |
| var scoresListTextViews = [UITextView]() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| redSlider.value = 0.71 | |
| greenSlider.value = 0.04 | |
| blueSlider.value = 0.22 | |
| alphaSlider.value = 1.0 | |
| updateView() | |
| } | |
| func updateView() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myVariable = 42 | |
| myVariable = 50 | |
| let myConstant = 42 | |
| //myConstant = 50 | |
| let scores = [75, 52, 93, 87, 41, 83] | |
| var totalPassing = 0 | |
| for score in scores { | |
| if score >= 60 { | |
| totalPassing += 1 |