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
| // _new simulates how `new` keyword works in JS | |
| function _new(func, args) { | |
| let obj = {}; | |
| Object.setPrototypeOf(obj, func.prototype); | |
| func.apply(obj, args); | |
| return obj; | |
| } | |
| function Point(x, y) { | |
| this.x = x; |
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
| $('body').css('transform', 'rotate(2deg)') |
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
| _.mixin({ | |
| listc: function(list, filter, map) { | |
| return _.map(_.filter(list, filter), map) | |
| } | |
| }); | |
| /** | |
| * Example: | |
| * var list = [1,2,3,4,5]; | |
| * var filter = function (num){ return num < 4; }; |
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 calculate_grade(): | |
| current = int(raw_input("Current grade:")) | |
| desired = int(raw_input("Grade desired:")) | |
| percent = float(raw_input("Final's % of Overall Grade:")) | |
| other_percent = 1 - (float(percent / 100)) | |
| alg = desired - float((current * other_percent)) | |
| grade_needed = round(float(alg / percent) * 100) | |
| print "The grade you need on your final to get your desired grade is " + str(grade_needed) |
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
| """ | |
| Look up the username associated with a particular email -- | |
| Note Django doesn't seem to create the email field with the UNIQUE attribute. | |
| If that is set to UNIQUE it appears that this is a nice workaround and | |
| very simple solution instead of changing db setup. | |
| Any security problems that you Githubbers and committers see in this? | |
| """ | |
| def login_email(request): | |
| try: |