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
// Ajax File upload with jQuery and XHR2 | |
// Sean Clark http://square-bracket.com | |
$.fn.upload = function(remote,data,successFn,progressFn) { | |
// if we dont have post data, move it along | |
if(typeof data != "object") { | |
progressFn = successFn; | |
successFn = data; | |
} | |
return this.each(function() { | |
if($(this)[0].files[0]) { |
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
<style>.gist{color:#000;}.gist div{padding:0;margin:0;}.gist .gist-file{border:1px solid #dedede;font-family:Monaco,'Courier New','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace;margin-bottom:1em;}.gist .gist-file .gist-meta{overflow:hidden;font-size:85%;padding:.5em;color:#666;background-color:#eaeaea;}.gist .gist-file .gist-meta a{color:#369;}.gist .gist-file .gist-meta a:visited{color:#737;}.gist .gist-file .gist-data{overflow:auto;word-wrap:normal;background-color:#f8f8ff;border-bottom:1px solid #ddd;font-size:100%;}.gist .gist-file .gist-data pre{font-family:'Bitstream Vera Sans Mono','Courier',monospace;background:transparent !important;margin:0 !important;border:none !important;padding:.25em .5em .5em .5em !important;}.gist .gist-file .gist-data .gist-highlight{background:transparent !important;}.gist .gist-file .gist-data .gist-line-numbers{background-color:#ececec;color:#aaa;border-right:1px solid #ddd;text-align:right;}.gist .gist-file .gist-data .gist-line-numbers span{clear:right;display:b |
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 add1(array, val, n) { | |
var iter = 0, | |
end = array.length, | |
count = (n) ? n : -1, | |
multiple = 1; | |
if(n < 0) { | |
iter = array.length - 1; | |
end = 0; | |
multiple = -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
openAuthoriseWindow = (url) -> | |
waitForPin = -> | |
if wnd.closed | |
pin = prompt("Please enter your PIN", "") | |
oauth.setVerifier pin | |
oauth.fetchAccessToken getSomeData, failureHandler | |
else | |
setTimeout waitForPin, 100 | |
wnd = window.open(url, "authorise") | |
setTimeout waitForPin, 100 |