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
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html | |
# https://www.varnish-cache.org/trac/wiki/VCLExamples | |
# Summary | |
# 1. Varnish will poll the backend at /health_check to make sure it is | |
# healthy. If the backend goes down, varnish will server stale content | |
# from the cache for up to 1 hour. | |
# 2. Varnish will pass X-Forwarded-For headers through to the backend | |
# 3. Varnish will remove cookies from urls that match static content file | |
# extensions (jpg, gif, ...) |
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
Total downloads: 215395 | |
linux : 112168 (52.00%) | |
macosx : 84828 (39.00%) | |
jruby : 9433 (4.00%) | |
windows : 8397 (3.00%) | |
bsd : 526 (0.00%) | |
solaris : 27 (0.00%) | |
x86-unknown : 9 (0.00%) | |
x86_64-unknown : 7 (0.00%) |
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 'selenium-webdriver' | |
path = File.expand_path("test.html") | |
File.open(path, "w") { |io| io << DATA.read } | |
browser = Selenium::WebDriver.for :firefox # replace :firefox with the browser you're having trouble with | |
begin | |
browser.get "file://#{path}" |
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
>> load './RUNME-demo_of_async_fibers.rb' | |
/Users/flip/ics/backend/son_of_a_batch/RUNME-demo_of_async_fibers.rb:4: warning: already initialized constant FIBER_IDXS | |
814e5e90 0 f_0 beg main top level | |
814e5e90 1 f_0 beg em setup this block sets up the eventmachine execution, but no execution-order shenanigans yet | |
814e5e90 2 f_0 beg fiber stp the end-the-reactor block won't be called for 1.5s, so we get here immediately. | |
814e5e90 3 f_0 end fiber stp nothing from inside the Fiber.new{} block has run yet. | |
814e5e90 4 f_0 end fiber stp kick off the fiber... | |
80d829a0 5 f_1 beg fiber when my_fiber.resume is called, this runs. Now in a new fiber | |
80d829a0 6 f_1 beg get_result get_result is called from within fiber_1 | |
80d829a0 7 f_1 setup callback set up some code to run 1.5s from now |
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 'ffi' | |
module Uname | |
extend FFI::Library | |
ffi_lib FFI::CURRENT_PROCESS | |
class UtsName < FFI::Struct | |
layout :sysname , [:char, 256], | |
:nodename, [:char, 256], |
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
# encoding: utf-8 | |
# Pure-ruby java.util.Properties-like class | |
class Properties < Hash | |
REGEXP = %r{ | |
\A\s* # ignore whitespace at BOL | |
([^\s\#;]+?) # the variable cannot contain spaces or comment characters | |
\s*=\s* # ignore whitespace around the equal sign | |
([^\#;]*?) # the value cannot contain comment characters | |
\s* # ignore whitespace at end of line |
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 "selenium-webdriver" | |
$DEBUG = true | |
profile = Selenium::WebDriver::Firefox::Profile.new | |
profile.log_file = File.expand_path("firefox.log") | |
profile.log_file.gsub!("/", "\\") if Selenium::WebDriver::Platform.windows? | |
begin |
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 'ffi' | |
module Clang | |
module Lib | |
extend FFI::Library | |
ffi_lib "clang" | |
attach_function :create_index, :clang_createIndex, [:int, :int], :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
Creating the bundled JRuby jar | |
============================== | |
Let's say we want to bundle these gems: | |
- Antwrap | |
- json_pure | |
- albacore | |
1. Check out JRuby HEAD | |
git clone git://github.com/jruby/jruby.git |
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 'selenium-webdriver' | |
require 'ext-tempfile' | |
script = <<S | |
var browserbot = { | |
triggerEvent: function(element, eventType, canBubble, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown) { | |
canBubble = (typeof(canBubble) == undefined) ? true: canBubble; | |
if (element.fireEvent && element.ownerDocument && element.ownerDocument.createEventObject) { | |
// IE |