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
/* | |
This is a slightly tweaked version of | |
https://github.com/nhira/node-simple-webserver/blob/master/webserver.js | |
*/ | |
var sys = require("sys"), | |
http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs"); |
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
/* | |
Chrome does not let you modify the keyCode prop when you trigger it, so it defaults to 0. | |
You can use this code to trigger a keydown with a char code of 0 in chrome. | |
If you use initKeyEvent instead of initKeyboardEvent, it will work in FF | |
(the bellow example would trigger keydown with a char code of 65 in FF). | |
*/ | |
document.addEventListener( 'keydown', function( event ){ | |
console.log( event.keyCode ) |
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 mainLoop = Abacus.timer({ | |
callback: function( data ) { | |
data.delta // time since the last tick | |
data.ticks // zero indexed number of ticks | |
} | |
}); | |
// Start the timer with an optional kill time in miliseconds | |
// if no miliseconds are passed in, it wil run FOR EV AR, until you pause it | |
mainLoop.start( 10000 ) |
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"> | |
<head> | |
<script src="http://code.jquery.com/jquery.js"></script> | |
<script src="http://google.com/jsapi"></script> | |
<script src="google-contacts-authsub.js"></script> | |
</head> | |
<body> | |
<!-- Google requires an image to be on the page --> | |
<img src="https://localhost/img/1px.png"> |
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
/* | |
usage: | |
$.bind('customEvt', function( event ){ | |
console.log( event ); | |
}); | |
$.trigger('customEvt'); | |
*/ |
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
// The jQuery for this carousel | |
var $featured = $('.featured'), | |
$featurenav = $('.featurenav') | |
.delegate('button', 'click', function(){ | |
$featurenav | |
.children() | |
.css('color', '#bbb'); | |
var $this = $(this).css('color', 'black'); |
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
<script src="http://code.jquery.org/jquery.js"></script> | |
<script src="https://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.min.js"></script> | |
<script src="http://butterapp.org/butter/popcorn-js/popcorn.js"></script> | |
<script> | |
// Pause the video when the user hovers over one of the plugins | |
// for more than 500 milliseconds | |
$('.butter-plugin').hover( |
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 databases = ['list', 'of', 'databases']; | |
$.each( databases, function(iterator, database) { | |
$.ajax({ | |
url: 'http://127.0.0.1:5984/' + database, | |
type: 'PUT', | |
success: function(response){ | |
console.log(response); | |
} | |
}); |
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
{ | |
category : "", // Required Single category from (http://opencivicdata.com/#categories-wg) | |
properties : {} // Required Common bin for domain specific properties from from (http://opencivicdata.com/#properties-wg) | |
start : "", // Optional RFC3339DateTime optional start date | |
end : "", // Optional RFC3339DateTime optional end date | |
geometry : {} // Optional Geojson location feature (http://geojson.org/geojson-spec.html) | |
} |
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
// Originally solved by Tim Branyen in his drop file plugin | |
// http://dev.aboutnerd.com/jQuery.dropFile/jquery.dropFile.js | |
jQuery.event.props.push('dataTransfer'); |