Skip to content

Instantly share code, notes, and snippets.

View elbart's full-sized avatar
🦀
Rustacean

Tim Eggert elbart

🦀
Rustacean
View GitHub Profile
@elbart
elbart / gist:945901
Created April 28, 2011 06:30 — forked from jb55/gist:945731
replace nginx with connect
var connect = require('connect')
, proxy = require('http-proxy')
function redirect(loc) {
return connect.createServer(function(req, res){
res.writeHead(301, { "Location": loc });
res.end();
});
}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.accordionHead').unbind('click').bind('click', function() {
$('.open').removeClass('open').slideUp('fast');
$(this).next('.accordionContent').slideDown('fast', function() {
$(this).addClass('open');
});
});
var loadScriptAsync = function(url) {
var body = document.body;
var div = document.createElement('div');
div.style.display = 'none';
body.insertBefore(div, body.firstChild);
var iframe = document.createElement('iframe');
iframe.frameborder = 0;
// seems like the meebo guys use this "m" tag for some magic I don't guess right now
var iframeSrc = 'http://mydomain.com?query=string';
var iframe = '<iframe id="myId"></iframe>';
$('body').append(iframe);
$('#myId').attr('src', iframeSrc);
var sys = require('sys'),
http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8000);
sys.puts('Server running at http://127.0.0.1:8000/');