Skip to content

Instantly share code, notes, and snippets.

@pope
pope / gist:262117
Created December 22, 2009 22:27 — forked from ezmobius/gist:262085
require 'rubygems'
require 'redis'
require 'json'
require 'eventmachine'
class RedisLoop
class << self
attr_accessor :queues
def start(opts={}, &blk)
EM.run {
@pope
pope / bad.js
Created December 16, 2009 20:50
(function() {
var foo = function() {
bar(); //global at time of parsing
};
var bar = function() {
alert("Hi");
};
})();
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Deletable Tabs</title>
<link type="text/css" href="jquery-ui/css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<style>
.delete {
cursor:pointer;
}
@pope
pope / echo.c
Created October 19, 2009 23:48 — forked from paulsmith/echo.c
/**
* A simple preforking echo server in C.
*
* Building:
*
* $ gcc -Wall -o echo echo.c
*
* Usage:
*
* $ ./echo
require 'rack'
module Rack
class FoxNews
PATH_INFO = "/fox-news".freeze
def initialize(app)
@app = app
diff --git a/tasks/gem.rake b/tasks/gem.rake
index 1f72241..94c3c6a 100644
--- a/tasks/gem.rake
+++ b/tasks/gem.rake
@@ -13,6 +13,9 @@ GEM_SPEC = Gem::Specification.new do |s|
# dependencies
s.add_dependency 'rake', '>= 0.8.3', '< 0.9'
+ s.bindir = 'bin'
+ s.executables = ['rake-compiler']
<div>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<ul>
<div>
def foo
puts "I was called"
end
def stupidcallback(cb)
puts "Before"
cb.call
puts "After"
end
# requires "isightcapture" in the cwd (http://www.intergalactic.de/pages/iSight.html)
require "eventmachine"
INTERVAL = 20
EM::run do
timer = EM::PeriodicTimer.new(INTERVAL) do
time = Time.now.strftime("%Y%m%d%H%M%S")
system "./isightcapture #{time}.jpg &"
puts time
~/Documents/code/ruby >ab -c 10 -n 100 http://localhost:3000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: thin
Server Hostname: localhost