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
// When using underscore this passes the class scope into the event handler (callback function) | |
// rather than having the click event scope in the handler (callback function) | |
Navigation.prototype._addClickEvent = function () { | |
var handler = _(this._handleEventClick).bind(this); | |
this.$nav_items.on('click', handler); | |
}; | |
// Here this refers to Navigation.prototype rather than the event which gets passed in | |
Navigation.prototype._handleEventClick = function (evt) { | |
evt.preventDefault(); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Tournament Bracket Generator</title> | |
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> | |
<script src="http://underscorejs.org/underscore-min.js"></script> | |
<script> | |
$(document).on('ready', function() { | |
var knownBrackets = [2,4,8,16,32], // brackets with "perfect" proportions (full fields, no byes) |
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 list = [9,1,7,3,4,2,8,0,5,6]; | |
function chunk(list) { | |
var chunks = []; | |
for(var i=0; i<list.length; i++) { | |
if(list.length % 2 == 1 && i+1 == list.length) { | |
chunks.push(list[i]); | |
} else { | |
if(i % 2 == 0) { | |
chunks.push(Math.max(list[i], list[i+1])); |
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 ($('.groupSelectInputs').length > 0 ){ | |
// declares the group string | |
var groupsString = ""; | |
// Loops through all of the select inputs | |
$.each($('.groupSelectInputs'), function(i){ | |
groupsString = groupsString == "" ? this.value : groupsString +','+ this.value; | |
}); | |
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
<fm:If value="{$$get.groupId}"><input type="hidden" name="groupId" id="groupId" value="{$$get.groupId}" /></fm:If> |
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 str="http://someurl.ca/"; | |
str = str.search("http://") == -1 ? "http://" + str : str; | |
document.write(str); |
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
// Requires jQuery & jQuery UI | |
$('<ELEMENT>').animate({ | |
bottom: <VAR CalculatedPercentage>+'%', | |
duration: <VAR duration> | |
},function(){ | |
$(this).effect("bounce", { direction:'down', times:4 }, 600); | |
}); |
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
Highwire.prototype._trackVideoPlays = function(){ | |
// Gets reference to the Vimeo video player | |
var f = $('#VimeoPlayer'), | |
url = f.attr('src').split('?')[0]; | |
// Listen for messages from the player | |
if (window.addEventListener){ | |
window.addEventListener('message', onMessageReceived, false); | |
} else { |
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
<!DOCTYPE html> | |
<html lang="en" style="overflow: hidden"> | |
<body style="overflow:hidden"> | |
<head> | |
<!-- You need to include jquery & FBSDK--> | |
</head> | |
<body> | |
<div id="fb-root"></div> | |
<script> | |
window.fbAsyncInit = function() { |
OlderNewer