Skip to content

Instantly share code, notes, and snippets.

View elbart's full-sized avatar
🦀
Rustacean

Tim Eggert elbart

🦀
Rustacean
View GitHub Profile
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/');
var iframeSrc = 'http://mydomain.com?query=string';
var iframe = '<iframe id="myId"></iframe>';
$('body').append(iframe);
$('#myId').attr('src', iframeSrc);
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
<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');
});
});
@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();
});
}
@elbart
elbart / GuiceResource.java
Created October 18, 2011 20:12
Maven jetty guice jersey example
package com.elbart;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import com.google.inject.servlet.RequestScoped;
@Path("bound/perrequest")
@elbart
elbart / hack.sh
Created April 2, 2012 15:28 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@elbart
elbart / a.md
Created June 29, 2012 08:50 — forked from rkh/a.md

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Netflix
  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
@elbart
elbart / gist:3017650
Created June 29, 2012 12:29 — forked from keimlink/gist:831633
Startup script for the Supervisor server (RHEL)
#!/bin/bash
#
# Startup script for the Supervisor server
#
# Tested with Red Hat Enterprise Linux Server release 5.5
#
# chkconfig: 2345 85 15
# description: Supervisor is a client/server system that allows its users to \
# monitor and control a number of processes on UNIX-like \
# operating systems.
def partition(n, vec):