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
checkFunctionDecl: function(line, lineNumber) { | |
var errors = []; | |
var functions = line.match(/function\s+\w+/g); | |
_.each(functions, function(fun) { | |
var name = fun.split(/\s+/g)[1]; | |
// I18N: Don't translate the '\" var %(name)s = function() {}; \"' part | |
var error = { | |
row: lineNumber, | |
column: line.indexOf(fun), |
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
// Functions to help figure out whether elements are in the viewport | |
// and lazy-load their content if so. | |
// Implemented as jQuery plugins. | |
(function() { | |
$.fn.inView = function(nearThreshold) { | |
var $elem = $(this); | |
// Checks if its visible, CSS-wise | |
if (!$elem.is(":visible")) { | |
return false; |
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 class is used to create the /topic/projectfeedback page, | |
* which shows expandable lists of feedback requests that need answering. | |
*/ | |
var ProjectFeedbackPage = React.createClass({ | |
propTypes: { | |
topic: React.PropTypes.string.isRequired | |
}, | |
render: function() { | |
var helpCollection = new DiscussionItemCollection([], { | |
topic: this.props.topic, |
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
/* | |
* BabyHint does a line-by-line check for common beginner programming mistakes, | |
* such as misspelling, missing spaces, missing commas, etc. It is used in | |
* conjunction with JSHINT to report errors to the user. | |
* | |
* Each error returned contains the members: | |
* { | |
* row : the row at which the error was found | |
* column : the column at which the error was found | |
* text : the error messaage |
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
Nov. 24, Hack 4 Queer Youth: http://mymaven.org/hack/ | |
Oct. 12, PilotSF High School Hackathon: http://sf.gopilot.org/ | |
Nov. 17th, OpenSV Youth Hackathon: http://opensv.org/index.php/events/open-sv-youth-forum-hackathon | |
Oct. 26-27 and Nov. 16-17, LPFI Hackathon: http://lpfi.org/hackathon | |
Assorted dates, CodeNow High School Trainings: http://codenow.org/apply/volunteer/ |
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
// Pop quiz! | |
// 1. What will x and y be in this code? | |
(function() { | |
var x = 5; | |
var y = 10; | |
var coordinates = x, y; | |
console.log('First'); | |
console.log(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
/** function set_speed(speed) | |
* Set the video speed | |
* | |
* @param double speed - target speed | |
* | |
* @return void | |
*/ | |
this.is_set_speed_enabled = function() { | |
var featureExists = typeof(this.mediaelement_media) === 'object' | |
&& this.mediaelement_media !== 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
import logging | |
import requests | |
from django.utils import simplejson | |
from django.conf import settings | |
class DeskError(Exception): | |
def __init__(self, status): | |
Exception.__init__(self, status) # Exception is an old-school class |
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 setupFormSave($form, xhrOptions, autoSave) { | |
xhrOptions = xhrOptions || {}; | |
var lastFormData = $form.serialize(); | |
xhrOptions.url = xhrOptions.url || $form.attr('action'); | |
xhrOptions.type = xhrOptions.type || $form.attr('type'); | |
var $saveButton = $form.find('button[type="submit"]'); | |
var $saveStatus = $($saveButton.attr('data-update')); | |
function changeButtonText(message) { |
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(wndw) { | |
/* | |
This library pops up a help window when the user clicks on the specified element. | |
For example, if you have a help tab like this: | |
<div class="course-help-widget-tab" | |
data-helpwidget data-helpwidget-link-docs="http://support.coursera.org" data-helpwidget-linkdiscuss="http://class.coursera.org/mooc/" | |
tabindex="0" role="button" aria-haspopup="true" aria-expanded="false">Help | |
</div> | |
And you call this JS: |