Skip to content

Instantly share code, notes, and snippets.

@jk16
jk16 / cookies.py
Created August 1, 2016 21:21
Verifying hashed cookies
import os
import webapp2
import hashlib
def hash_str(s):
return hashlib.md5(s).hexdigest()
def make_secure_val(s):
return "%s|%s" % (s, hash_str(str(s)))
package textgen;
import java.util.AbstractList;
/** A class that implements a doubly linked list
*
* @author UC San Diego Intermediate Programming MOOC team
*
* @param <E> The type of the elements stored in the list
class LoginPageHandler(tornado.web.RequestHandler):
@gen
def post(self):
response = {"success": True, "message": "logged in successfully"}
self.set_header("Content-Type", "application/json")
sleep = yield gen.sleep(5)
sleep.add_done_callback(
self.write(json.dumps(response))
)
@jk16
jk16 / todo.md
Last active January 25, 2016 10:46

Todo

  • Submit: Change what it says
  • Make a JS File and link it in the header.
  • Capture the submit event of the login form. [DONE]
    • Send the username to the server via ajax POST (you will get an error bc it is a non existent pg) [DONE]
  • Login should be hidden before the js loads then the JS will showit [DONE]
  • Make a login page handler (tornado) [DONE]
  • response: {success: true, message: LOGGED IN} [DONE]
package testScripts;
public class Tuple<String, Boolean> {
public String letter;
public Boolean vBool;
public Tuple(String letter, Boolean vBool) {
this.letter = letter;
this.vBool = vBool;
}
public class Tuple<Letter, VBoolean> {
public Letter letter;
public VBoolean vBool;
public Tuple(Letter l, VBoolean vBool) {
this.letter = l;
this.vBool = vBool;
}
}
package testScripts;
public class Main {
public static void main(String[] args) {
MyClass instance = new MyClass("word");
System.out.println(instance);
/*
Prints: testScripts.MyClass@2a139a55 I want word
*/
package searchSort;
import java.util.ArrayList;
import java.util.Collections;
public class Airport implements Comparable<Airport> {
private String city;
private String country;
private String code;