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
# = Description | |
# A load time profiler script, useful for identifying requires | |
# that slow down the loading of a script. | |
# | |
# Oftentimes we use but don't always need what we require in | |
# scripts. This can dramatically slow load times, which can be | |
# annoying. Use this script to identify slow-loading parts of | |
# a script and then consider using autoloading to defer | |
# the require until you really need it. | |
# |
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
#!/usr/bin/env ruby | |
################################################################ | |
# A basic cgi script. To run, set up the following: | |
# | |
# /dir | |
# |- cgi-bin | |
# | `- this_script.cgi | |
# `- the_webrick_script.rb | |
# |
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
////////////////////////////////////////////////////////////////////////////// | |
// | |
// RedirectHttp | |
// | |
// Note Ubiquity makes these objects available (the list is incomplete, but | |
// contains the objects that are used in this script): | |
// | |
// - Application:: the FUEL[http://developer.mozilla.org/en/FUEL] Application object | |
// - CmdUtils:: Ubiquity command utilities | |
// |
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
# These are a number of tasks to calculate peptide masses | |
# using a variety of algorithms. The intent is to find | |
# the algorithm used by Mascot to calculate peptide mass. | |
# | |
# Correct algorithm: unknown | |
# Dependencies: tap, molecules | |
# | |
require 'rubygems' | |
require 'tap' |
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
# = Description | |
# | |
# SimpleYaml provides methods to dump and load simple configurations. | |
# Support is limited strings, symbols, booleans, nil, and numbers. | |
# Values may include non-nested arrays. Nested hashes are not | |
# supported anywhere. | |
# | |
# include SimpleYaml | |
# hash = { | |
# :sym => 'str', |
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 'minitest/spec' | |
module A | |
module B | |
end | |
end | |
class DirectInclude | |
include A |
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
# usage: ruby echo_server.rb | |
# | |
# Launches a WEBRick server that echos http requests back. This can be | |
# useful when debugging HTTP requests. | |
# | |
require 'webrick' | |
# Setup server configuration | |
logger = WEBrick::Log.new |
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
////////////////////////////////////////////////////////////////////////////// | |
// | |
// Tap | |
// | |
// Note Ubiquity makes these objects available (the list is incomplete, but | |
// contains the objects that are used in this script): | |
// | |
// - Application:: the FUEL[http://developer.mozilla.org/en/FUEL] Application object | |
// - jQuery:: http://docs.jquery.com/Main_Page | |
// - Utils:: Ubiquity utilities |
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
# This illustrates how IO duplicates flush separately. | |
# The danger is that this can result in disordered | |
# output. Run this from the command line: | |
# | |
# % ruby io_duplicate_danger.rb | |
# 1 | |
# 2 | |
# 3 | |
# | |
# You get what you expect. Now try with redirection: |
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
# Setting options for to_yaml doesn't work. | |
# * http://www.arkanis-development.de/weblog/2007/6/20/options-for-rubys-@to_yaml@-method | |
# * http://groups.google.com/group/ruby-talk-google/browse_thread/thread/b9bd01242f7d67ae/7186dd14f9e1e3ff#7186dd14f9e1e3ff | |
# | |
# This is an attempt to workaround by directly setting a flag in the | |
# emitter. Fail. If I recall right, trying to set/modify the @options | |
# hash also does not work. | |
# | |
# :UseHeader => false | |
# |
OlderNewer