This file contains 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
{"sports" :[{"name" :"football","id" :20,"leagues" :[{"name" :"NCAA Football","abbreviation" :"college-football","id" :23,"groupId" :99,"shortName" :"NCAA Football","events" :[{"id" :323150130,"date" :"2012-11-10T17:00:00Z","season" :{"year" :2012,"type" :2,"description" :"regular","startDate" :"2012-08-28T07:00:00Z","endDate" :"2012-12-18T07:59:59Z"},"timeValid" :true,"competitions" :[{"id" :323150130,"date" :"2012-11-10T17:00:00Z","stats" :{"attendance" :0},"competitors" :[{"type" :"team","score" :28,"homeAway" :"home","team" :{"id" :130,"homeAway" :"home","location" :"Michigan","name" :"Wolverines","nickname" :"Michigan","abbreviation" :"MICH","color" :"001531","links" :{"api" :{"teams" :{"href" :"http://api.espn.com/v1/sports/football/college-football/teams/130"}}},"record" :{"summary" :"6-3","wins" :6,"losses" :3,"overtimeLosses" :0,"ties" :0}}},{"type" :"team","score" :31,"homeAway" :"away","team" :{"id" :77,"homeAway" :"away","location" :"Northwestern","name" :"Wildcats","nickname" :"N'western","abbre |
This file contains 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
{"sports" :[{"name" :"basketball","id" :40,"leagues" :[{"name" :"National Basketball Assoc.","abbreviation" :"nba","id" :46,"groupId" :7,"shortName" :"NBA","events" :[{"id" :400277801,"date" :"2012-11-11T00:00:00Z","season" :{"year" :2013,"type" :2,"description" :"regular","startDate" :"2012-10-30T07:00:00Z","endDate" :"2013-04-18T06:59:59Z"},"timeValid" :true,"competitions" :[{"id" :400277801,"date" :"2012-11-11T00:00:00Z","stats" :{"attendance" :0},"competitors" :[{"type" :"team","score" :0,"homeAway" :"home","team" :{"id" :28,"homeAway" :"home","location" :"Toronto","name" :"Raptors","abbreviation" :"TOR","color" :"CE0F41","links" :{"api" :{"teams" :{"href" :"http://api.espn.com/v1/sports/basketball/nba/teams/28"}}},"record" :{"summary" :"1-4","wins" :1,"losses" :4,"overtimeLosses" :0,"ties" :0}}},{"type" :"team","score" :0,"homeAway" :"away","team" :{"id" :20,"homeAway" :"away","location" :"Philadelphia","name" :"76ers","abbreviation" :"PHI","color" :"000000","links" :{"api" :{"teams" :{"href" :"http://a |
This file contains 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
def normalize_file_path(path): | |
#assumptions: valid path does not start with '../' or '/..' | |
if path.startswith('../') or path.startswith('/..'): | |
return None | |
#normalize all the double dots first |
This file contains 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
def normalize_file_path(path): | |
#assumptions: valid path does not start with '../' or '/..' | |
if path.startswith('../') or path.startswith('/..'): | |
return None #alternatively, raise an exception | |
#normalize all the double dots first |
This file contains 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
from django.contrib.auth.models import User | |
from facebookconnect.models import FacebookProfile | |
from django.conf import settings | |
from django.core.urlresolvers import reverse | |
import facebook | |
from facebookconnect.utils import facebook_login_check, get_access_token | |
class FacebookConnectBackend: | |
""" |
This file contains 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
class FacebookBackend: | |
""" | |
Authenticates against django.contrib.auth.models.User. | |
""" | |
@ staticmethod | |
def authenticate(request): | |
if 'access_token' in request.session: |
This file contains 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
# Sorting a List using Mergesort in Python | |
# 2011-05-16 | |
def mergeSort(toSort): | |
if len(toSort) <= 1: | |
return toSort | |
mIndex = len(toSort) / 2 | |
left = mergeSort(toSort[:mIndex]) | |
right = mergeSort(toSort[mIndex:]) |
This file contains 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
def get_val(): | |
words = { 1 : 'one', 2 : 'two', 3 : 'three', 4 : 'four', 5 : 'five', 6 : 'six', 7 : 'seven' | |
, 8 : 'eight', 9 : 'nine', 10 : 'ten', 11 : 'eleven', 12 : 'twelve', 13 : 'thirteen' | |
, 14 : 'fourteen', 15 : 'fifteen', 16 : 'sixteen', 17 : 'seventeen', 18 : 'eighteen' | |
, 19 : 'nineteen', 20 : 'twenty', 30 : 'thirty', 40 : 'forty', 50 : 'fifty', 60 : 'sixty' | |
, 70 : 'seventy', 80 : 'eighty', 90 : 'ninety', 100 : 'hundred', 1000 : 'thousand' } |
This file contains 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 android.app.Activity; | |
import android.content.Intent; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.net.Uri; | |
import android.os.Bundle; | |
import android.os.Environment; | |
import android.provider.MediaStore; | |
import android.util.Log; |
This file contains 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
def get_access_token(request): | |
token = request.GET.get('token', None) | |
if not token: | |
return HttpResponse('error') | |
users = GlassUser.Query.all().eq(token=token) |