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
| define([ 'jquery' ], function($) { | |
| $.fn.notification = function(msg_type, msg, options) { | |
| var container = this; | |
| var defaults = { | |
| autoHide: true, | |
| hideSpeed: 3000, | |
| fadeInSpeed: 'fast', | |
| hideOthers: true | |
| }; |
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
| @yellow: yellow; | |
| @green: green; | |
| .pie { | |
| behavior: url(PIE.htc); | |
| } | |
| @import "css/mixins"; | |
| @import "css/base"; | |
| @import "css/tables"; |
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
| from django import template | |
| register = template.Library() | |
| @register.filter | |
| def truncatewords_by_chars(value, arg): | |
| """ | |
| Truncate words based on the number of characters | |
| based on original truncatewords filter code | |
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
| define([ 'jquery' ], function($) { | |
| var Tooltip = function(element, options) { | |
| this.$element = $(element); | |
| var tooltip = this, | |
| title = this.$element.attr('title'); | |
| this.options = $.extend({}, $.fn.tooltip.defaults, options); | |
| this.text = this.$element.removeAttr('title') && title || this.options.text; |
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
| from django.db import models | |
| class Banana(models.Model): | |
| name = models.CharField(max_length=255) | |
| father = models.ForeignKey('self', null=True) | |
| def __unicode__(self): | |
| return self.name |
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 iterative(n): | |
| if n == 0 or n == 1: | |
| return n | |
| prev2 = 0 | |
| prev1 = 1 | |
| for index in xrange(2, n + 1): | |
| ivalue = prev1 + prev2 | |
| prev2 = prev1 | |
| prev1 = ivalue | |
| if index == n: |
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
| define([ | |
| 'jquery', | |
| 'underscore', | |
| 'backbone', | |
| 'mustache' | |
| ], function($, _, Backbone, Mustache){ | |
| var view = Backbone.View.extend({ | |
| model: null, | |
| template: null, |
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
| """ | |
| This file enables email-based authentication for Django. The only steps required are | |
| 1. Add 'EmailAuthenticationBackend' to your settings' AUTHENTICATION_BACKENDS file | |
| 2. Add the {'authentication_form': EmailAuthenticationForm} to your login view (if using 'django.contrib.auth.views.login') | |
| 3. When saving a User instance, generate the username from the email using the 'generate_hash_from_email' function | |
| """ | |
| import hashlib | |
| from django import forms |
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
| function Engineer () {} | |
| Engineer.prototype = { | |
| getYearsWorked: function () { | |
| return this.yearsWorked; | |
| } | |
| }; | |
| function UIEngineer (years) { | |
| this.yearsWorked = years; |