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
<form action="https://launchpad.37signals.com/authenticate" method="post"> | |
<input name="product" value="YOUR-PRODUCT" type="hidden" /> | |
<input name="subdomain" value="YOUR-SUBDOMAIN" type="hidden" /> | |
<p>Username<br /> | |
<input name="username" id="username" type="text" /></p> | |
<p>Password<br /> | |
<input name="password" id="password" type="password" /></p> |
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
# The Fractal Geometry of Recursive Arrays | |
a = [] | |
a << a << :b | |
p a | |
p a[0] | |
p a[0][0] | |
# ad infinitum... |
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
// An Unobtrusive Javascript (UJS) driver based on explicit behavior definitions. Just | |
// put a "data-behaviors" attribute on your view elements, and then assign callbacks | |
// for those named behaviors via Behaviors.add. | |
var Behaviors = { | |
add: function(trigger, behavior, handler) { | |
document.observe(trigger, function(event) { | |
var element = event.findElement("*[data-behaviors~=" + behavior + "]"); | |
if (element) handler(element, event); | |
}); |
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
# -------------------------------------------------------------------- | |
# An implementation of Prim's algorithm for generating mazes. | |
# This is a pretty fast algorithm, when implemented well, since it | |
# only needs random access to the list of frontier cells. It does | |
# require space proportional to the size of the maze, but even worse- | |
# case, it won't be but a fraction of the size of the maze itself. | |
# As with Kruskal's, this algorithm tends to generate mazes with many | |
# short cul-de-sacs. | |
# -------------------------------------------------------------------- | |
# NOTE: the display routine used in this script requires a terminal |
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
# -------------------------------------------------------------------- | |
# An implementation of the "Hunt and Kill" algorithm. This is fairly | |
# similar to the recursive backtracking algorithm, except that there | |
# is no recursion, and it doesn't backtrack. :) The algorithm can | |
# get a little slow towards the end, where the "hunt" phase has to | |
# search over nearly the entire field to find a candidate cell, but | |
# it's guaranteed to finish (unlike Aldous-Broder and Wilson's), and | |
# it's still pretty fast. | |
# -------------------------------------------------------------------- |
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
# -------------------------------------------------------------------- | |
# An implementation of Wilson's algorithm for generating mazes. | |
# Slightly smarter than Aldous-Broder, it is novel in its use of a | |
# "scout" to build each path before actually recording it. Like | |
# Aldous-Broder, though, it is not guaranteed to ever finish, if | |
# the RNG makes poor choices. | |
# | |
# As with Aldous-Broder, watching the animation of its progress can | |
# be an exercise in frustration as you find yourself urging the cursor | |
# to JUST GO OVER THERE! Try it and see for yourself. :) |
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
# -------------------------------------------------------------------- | |
# An implementation of the Sidewinder algorithm for maze generation. | |
# This algorithm is kind of a cross between the trivial Binary Tree | |
# algorithm, and Eller's algorithm. Like the Binary Tree algorithm, | |
# the result is biased (but not as heavily). | |
# | |
# Because the Sidewinder algorithm only needs to consider the current | |
# row, it can be used (like the Binary Tree and Eller's algorithms) | |
# to generate infinitely large mazes. | |
# -------------------------------------------------------------------- |
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
# -------------------------------------------------------------------- | |
# An implementation of a "weave" maze generator. Weave mazes are those | |
# with passages that pass both over and under other passages. The | |
# technique used in this program was described to me by Robin Houston, | |
# and works by first decorating the blank grid with the over/under | |
# crossings, and then using Kruskal's algorithm to fill out the rest | |
# of the grid. (Kruskal's is very well-suited to this approach, since | |
# it treats the cells as separate sets and joins them together.) | |
# -------------------------------------------------------------------- | |
# NOTE: the display routine used in this script requires a terminal |
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
# -------------------------------------------------------------------- | |
# An implementation of a "weave" maze generator. Weave mazes are those | |
# with passages that pass both over and under other passages. The | |
# technique used in this program was described to me by Robin Houston, | |
# and works by first decorating the blank grid with the over/under | |
# crossings, and then using Kruskal's algorithm to fill out the rest | |
# of the grid. (Kruskal's is very well-suited to this approach, since | |
# it treats the cells as separate sets and joins them together.) | |
# -------------------------------------------------------------------- | |
# NOTE: the display routine used in this script requires a terminal |
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
########################################################################### | |
# cube-maze.rb | |
# by Jamis Buck (jamis@jamisbuck.org) | |
# ------------------------------------------------------------------------- | |
# This script generates a PNG image of all six faces of a cube, covered | |
# with the passages of a maze that wraps across all the faces. | |
# | |
# The movements between faces are computed using the WRAPS constant, which | |
# tells which face lies in each direction from any given face, as well as | |
# how the coordinates should be transformed when moving from face to face. |