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
//for (var i = 0; i < mapPoints.length; i++){ | |
// for (var j = i + 1; j < mapPoints.length; j++){ | |
// var p1 = mapPoints[i]; | |
// var p2 = mapPoints[j]; | |
// if (getDistance(p1, p2) < 0.1){ // If distance between points is greater than .1 km | |
// var midpoint = getMidpoint(p1, p2); | |
// | |
// mapPoints.push(midpoint); | |
// mapPoints.splice(i, 1); | |
// mapPoints.splice(j, 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
<meta name="viewport" content="width=1280, initial-scale=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
module("sticky scroll unit tests",{ | |
"setup":function(){ | |
this.$el = $("<div></div>"); | |
}, | |
"getStickyScrollPlugin":function($el){ | |
return $.data($el.get(0), "plugin_stickyScroll"); | |
} | |
}); | |
test("sticky scroll default class is scrolled-off", function(){ |
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
(function($,window, undefined){ | |
var pluginName = "stickyScroll", | |
defaults = { | |
"class":"scrolled-off" | |
} | |
function Plugin( element, options ) { | |
this.element = element; | |
this.options = $.extend( {}, defaults, options) ; |
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
(function($,window, undefined){ | |
module("sticky scroll unit tests",{ | |
"setup":function(){ | |
this.$el.get(0).getBoundingClientRect = function(){ | |
return {left:100,top:100}; | |
} | |
}, | |
"setupSpies":function($el){ | |
var plugin = this.getStickyScrollPlugin($el); | |
plugin.elementScrolledOff = sinon.spy(); |
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
Plugin.prototype.init = function(){ | |
var self = this, | |
offset = $(this.element).offset(); //need to inject test data here | |
$(window).scroll(function(event){ | |
//event.target is usually the object that jQuery was called on | |
//I could have used this or $(window), but neither is testable | |
if(elementIsOutsideViewport(event.target, offset)){ | |
self.elementScrolledOff(); | |
} | |
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
module("sticky scroll integration tests",{ | |
"setup":function(){ | |
this.$el = $("<div class='test-scroll'></div>"); | |
this.$el.appendTo(document.body); | |
}, | |
"expandDocumentBody":function($el){ | |
$(document.body).css("height","10000px"); | |
}, | |
"shrinkDocumentBody":function($el){ | |
$(document.body).css("height","auto"); |
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
Vagrant::Config.run do |config| | |
config.vm.box = "base" | |
config.vm.network(:hostonly, "33.33.33.10") | |
config.vm.network(:bridged) | |
config.vm.forward_port(80, 4567) | |
en |
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
/* | |
* grunt | |
* https://github.com/cowboy/grunt | |
* | |
* Copyright (c) 2012 "Cowboy" Ben Alman | |
* Copyright (c) 2012 John K. Paul @johnkpaul | |
* Licensed under the MIT license. | |
* http://benalman.com/about/license/ | |
*/ |
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
// ==UserScript== | |
// @match http://jsfiddle.net/* | |
// ==/UserScript== | |
// @author: John K. Paul @johnkpaul | |
// @license: http://www.opensource.org/licenses/MIT | |
// http://johnkpaul.tumblr.com/post/21030300518/changing-jsfiddles-default-library-to-jquery | |
(function(){ | |
var script = document.createElement('script'); |