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
require 'rubygems' | |
require 'redis' | |
require 'json' | |
require 'eventmachine' | |
class RedisLoop | |
class << self | |
attr_accessor :queues | |
def start(opts={}, &blk) | |
EM.run { |
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() { | |
var foo = function() { | |
bar(); //global at time of parsing | |
}; | |
var bar = function() { | |
alert("Hi"); | |
}; | |
})(); |
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 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; | |
} |
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
/** | |
* A simple preforking echo server in C. | |
* | |
* Building: | |
* | |
* $ gcc -Wall -o echo echo.c | |
* | |
* Usage: | |
* | |
* $ ./echo |
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
require 'rack' | |
module Rack | |
class FoxNews | |
PATH_INFO = "/fox-news".freeze | |
def initialize(app) | |
@app = app |
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
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'] |
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
<div> | |
<ul> | |
<li>One</li> | |
<li>Two</li> | |
<li>Three</li> | |
<li>Four</li> | |
<ul> | |
<div> |
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
def foo | |
puts "I was called" | |
end | |
def stupidcallback(cb) | |
puts "Before" | |
cb.call | |
puts "After" | |
end |
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
# 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 |
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
~/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 |