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 renderNewPostForm(request, response){ | |
response.writeHead(200, {'Content-type': 'text/html'}); | |
response.end('hello world'); | |
} |
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
jQuery.each($(document).data('events'), function(i, event){ | |
jQuery.each(event, function(i, handler){ | |
console.log(handler.toString()); | |
}); | |
}); |
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> | |
<head> | |
<meta charset="utf-8"> | |
<title>HTML</title> | |
</head> | |
<body> | |
<div>content</div> | |
</body> | |
</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
function ajaxRequest(target, method, params, callback, graph) { | |
var xmlhttp=false; | |
if (!xmlhttp && typeof XMLHttpRequest!='undefined') { | |
try { | |
xmlhttp = new XMLHttpRequest(); | |
} catch (e) { | |
xmlhttp=false; | |
} | |
} | |
if (!xmlhttp && window.createRequest) { |
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 request = $.ajax({ | |
url: "/url", | |
type: "POST", | |
data: {"id" : 0}, | |
dataType: "html" | |
}); | |
request.done(function(msg) { | |
console.log(msg); | |
}); |
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 inArray(item, arr) { | |
for (var p=0; p<arr.length; p++) if (item === arr[p]) return true; | |
return false; | |
} |
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 you don't use underscore.js, use it (http://documentcloud.github.com/underscore/) | |
// Then, use underscore's mixin method to extend it with all your other utility methods | |
// like so: | |
_.mixin({ | |
escapeHtml: function () { | |
return this.replace(/&/g,'&') | |
.replace(/>/g,'>') | |
.replace(/</g,'<') | |
.replace(/"/g,'"') | |
.replace(/'/g,'''); |
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
// plug it in, plug it in | |
(function($) { | |
var paraCount = function() { | |
return { | |
options: { | |
itemClass: 'awesome', | |
baseUrl: "/", |
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($) { | |
// functions and vars here | |
var underline = function underline(e) { | |
$(e.currentTarget).css({ "color" : "yellow" }); | |
}; | |
// -------------------------------------------------------------------- | |
$.fn.simpleOne = 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 doAjax(){ | |
return $.get('/echo/html/'); | |
} | |
function doMoreAjax(){ | |
return $.get('/echo/html/'); | |
} | |
$.when( doAjax(), doMoreAjax() ) | |
.then(function(){ |
OlderNewer