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.isSetSpeedEnabled = function() { | |
if(typeof(this.mediaElement) === 'object' | |
&& this.mediaElement !== null | |
&& typeof(this.mediaElement.playbackRate) === 'number' | |
&& this.mediaElement.playbackRate > 0){ | |
return true; | |
} | |
else{ | |
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
GreaseMonkey | |
Read this tutorial to learn how to make GreaseMonkey scripts for Firefox, you should have a basic script by the end. | |
Read this article to learn how to get them working in Chrome and check yours works. | |
Amazon Linker | |
In this exercise, you’ll make a GreaseMonkey script that will run on Amazon product pages for movies and TV shows (e.g., The Matrix), and add a link to your favorite review site, like Rotten Tomatoes or MetaCritic. The steps: | |
Make sure your script only runs on Amazon URLs. |
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
Exercise: Nutrition Facts | |
Create an empty webpage. | |
Download nutrition.xml from https://gist.github.com/3000322 and place in your project folder. | |
Use AJAX via jQuery or JS API to fetch the file into the page. | |
Create a table. For each <food> in the XML file, create a row in the table with the food name and nutritional facts - serving size, calories, carbs. | |
Bonus: Use the tablesorter jQuery plugin to make the table sortable by the nutritional facts. | |
Exercise: Lady Gaga News |
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
Project: JavaScript Data Visualization | |
The purpose of this project is to find some interesting data, display that data in JS, give users a way to do calculations on it, and visualize it using graphics libraries and/or APIs. | |
Create a folder for the project. | |
Initialize a git repository for the project and create a Github repo for it, so that you can push commits to the remote Github repo. Commit for each stage of the project (or even more often than that, if you’d like) | |
See slides: Git | |
Find an interesting dataset in some sort of text format (XML, JSON, CSV, etc). Store the dataset in your project folder. Truncate it to a reasonable length if it’s very long (i.e. 1000 rows). Some possible sources are: | |
https://explore.data.gov/ | |
http://www.usgovxml.com/ |
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 loadVisibleImages() { | |
var placeholders = { | |
'meal': 'img/meal.png', | |
'avatar': 'img/blankpic.png' | |
}; | |
$('img').each(function() { | |
var $img = $(this); | |
var realUrl = $img.attr('data-src'); | |
if (!realUrl) return; |
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 Lindsey Simon | |
/** | |
* This is a hack to make text input focus work in Android/PhoneGap | |
* where calling el.focus() doesn't actually have the blinking cursor | |
* effect = scumbag. | |
* @param {Zepto} $el A zepto element. | |
*/ | |
ws.focus = function($el) { | |
var el = $el.get(0); | |
el.focus(); |
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
// isDefined(window, 'google'); | |
// isDefined(window, 'google.maps.places'); | |
var isDefined = function(parent, name) { | |
var parts = name.split('.'); | |
var part = parts.shift(); | |
var cur = parent; | |
while (part) { | |
if (cur[part]) { | |
cur = cur[part]; |
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
<div class="control-group"> | |
<label class="control-label">Location</label> | |
<div class="controls"> | |
<input name="location" type="text" placeholder="City, State, Country" value=""> | |
<input name="location_city" type="hidden" value=""> | |
<input name="location_state" type="hidden" value=""> | |
<input name="location_country" type="hidden" value=""> | |
<input name="location_lat" type="hidden"> | |
<input name="location_lng" type="hidden"> | |
</div> |
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
<html> | |
<head> | |
<style> | |
.w100percent { | |
} | |
.w1280px { | |
} | |
.w900px { | |
} | |
.w768px { |
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
<form id="coursera-form" action="/api/save" enctype="multipart/form-data" method="POST" class="form-horizontal"> | |
<!-- form inputs here --> | |
<div class="form-actions"><button type="submit" data-default-message="Save Changes" data-inflight-message="Saving..." data-success-message="Saved!" class="coursera-save-button btn btn-primary" disabled="disabled">Saved!</button></div> | |
</form> |