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
students = [{ | |
"name": "Lloyd", | |
"homework": [90.0, 97.0, 75.0, 92.0], | |
"quizzes": [88.0, 40.0, 94.0], | |
"tests": [75.0, 90.0] | |
},{ | |
"name": "Alice", | |
"homework": [100.0, 92.0, 98.0, 100.0], | |
"quizzes": [82.0, 83.0, 91.0], | |
"tests": [89.0, 97.0] |
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
print(""" | |
Welcome to the Menu Generator 3000! | |
To view your current menu('s), enter 'View' | |
To create a new menu, enter 'New' | |
To exit the Menu Generator 3000, enter 'Exit' | |
""") |
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
print("Welcome to the Menu Generator 3000!") | |
print("To view your current menu('s), enter 'View'") | |
print("To create a new menu, enter 'New'") | |
print("To exit the Menu Generator 3000, enter 'Exit'") | |
def new_menu(x): | |
print("you may create 5 items in your menu...") |
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
errors = [] | |
try: | |
model.save() | |
except Exception as e: | |
errors.append((model.id, e)) |
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
# example friendship | |
class UserProflile(models.Model): | |
''' | |
normal fields | |
''' | |
friends = models.ManyToManyField(UserProfile, related_name='friends', blank=True, null=True) | |
''' | |
methods |
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
/* Simple JavaScript Inheritance | |
* By John Resig http://ejohn.org/ | |
* MIT Licensed. | |
*/ | |
// Inspired by base2 and Prototype | |
(function(){ | |
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; | |
// The base Class implementation (does nothing) | |
this.Class = function(){}; |
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
#station-wrap { | |
position: relative; | |
padding-left: 6%; | |
margin-bottom: 120px; | |
padding-right: 10px; | |
.station-title { | |
font-size: 24px; | |
position: relative; | |
max-width: 1512px; | |
margin-right: 40px; |
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
&.item0 { | |
p { | |
color: lighten(@ddd-gray, 100%); | |
} | |
} | |
&.item1 { | |
p { | |
color: lighten(@ddd-gray, 40%); | |
text-shadow: 0.1px 0.1px #000; |
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
ImportError at / | |
No module named core.models | |
Request Method: GET | |
Request URL: http://127.0.0.1:8080/ | |
Django Version: 1.4.2 | |
Exception Type: ImportError | |
Exception Value: | |
No module named core.models | |
Exception Location: /Users/robert/Sites/myxer-gae/myxer/core/admin/__init__.py in <module>, line 3 | |
Python Executable: /Users/robert/.virtualenvs/gae/bin/python |
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
def get_artists(self, profile, limit=10, offset=0): | |
#logging.debug('get_artists: query playlist') | |
playlist = memcache.get('station_%s_artist' % self.pk) | |
if not playlist: | |
#logging.debug('get_artists: caching playlist') | |
playlist = list(PlaylistEntry.objects.filter(station_id=self.pk).order_by('rank')) | |
memcache.add('station_%s_artist' % self.pk, playlist, 60*60*4) | |
#logging.debug('get_artists: query playlist end') | |
# maybe query once for a list of tracks and work from this list? | |
#logging.debug('get_artists: query tracks') |