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
Handlebars.registerHelper('equal', function(lvalue, rvalue, options) { | |
if (arguments.length < 3) | |
throw new Error("Handlebars Helper equal needs 2 parameters"); | |
if( lvalue!=rvalue ) { | |
return options.inverse(this); | |
} else { | |
return options.fn(this); | |
} | |
}); |
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
# A worked example based on http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/urldispatch.html#using-pyramid-security-with-url-dispatch | |
# in your configuration section (typically in myapp/__init__.py) | |
config.add_route('articles.edit', 'article/{id}/edit', factory='myapp.acl.ArticleACL') | |
# in myapp/acl.py | |
class ArticleACL(object): | |
def __init__(self, request): | |
# First, we assume this ACL object is used only in routes that provide an article id; if need be, you can add some sanity checking here, or some if/else branching |
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
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () { | |
var Storage = function (type) { | |
function createCookie(name, value, days) { | |
var date, expires; | |
if (days) { | |
date = new Date(); | |
date.setTime(date.getTime()+(days*24*60*60*1000)); | |
expires = "; expires="+date.toGMTString(); |
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 gradeLetters = ['a', 'b+', 'b', 'c+', 'c', 'd', 'f', 'af', 'wf'], | |
gradePoints = [4, 3.5, 3, 2.5, 2, 1, 0, 0, 0]; | |
function getNumCoursesToBeEntered() { | |
"use strict"; | |
var numCourses = 0, | |
input = ""; | |
do { | |
input = prompt("Enter number of subjects?"); |