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
$.fn.equalHeights = function(px) { | |
var tallestHeight = 0; | |
if (!px) { | |
$(this).each(function() { | |
if ($(this).height() > tallestHeight) { | |
tallestHeight = $(this).height(); | |
} | |
}); |
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
Assuming image resolution: | |
72ppi = 5184 pixels per square inch | |
Surface area of the Earth: | |
510,072,000 km2 = (7.90613181 × 10 to the 17th) square inches | |
Assuming (for a lossless PNG) an average storage size of: | |
~7.76 bits per pixel | |
7.90613181 × 10 to the 17th square inches |
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 Matrix.columns(columns) | |
rows = (0 .. columns[0].size - 1).collect { | |
|i| | |
(0 .. columns.size - 1).collect { | |
|j| | |
columns[j][i] | |
} | |
} | |
Matrix.rows(rows, false) |
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 | |
require 'matrix' | |
a = [ [ 1, 2, 3 ], [ :a, :b, :c ], [ 'x', 'y', 'z' ], [ '#', '%' ] ] | |
puts "Attempting to create a matrix" | |
puts "a = [" | |
a.each { |x| puts " #{x.inspect}" } | |
puts "]" |
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
$ ruby ./matrix_test.rb | |
Attempting to create a matrix | |
a = [ | |
[1, 2, 3] | |
[:a, :b, :c] | |
["x", "y", "z"] | |
["#", "%"] | |
] | |
Matrix.columns(a) | |
Matrix[[1, a, x, #], [2, b, y, %], [3, c, z, ]] |
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
$ cat /etc/*-release | |
DISTRIB_ID=Ubuntu | |
DISTRIB_RELEASE=10.10 | |
DISTRIB_CODENAME=maverick | |
DISTRIB_DESCRIPTION="Ubuntu 10.10" | |
$ uname -a | |
Linux slim 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux |
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 | |
class Fixnum | |
def < (other) | |
puts "Determining membership of #{self.inspect} in #{other.inspect}..." | |
return false unless other | |
if other.is_a? Enumerable or other.is_a? Array | |
other >= self | |
else |
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
7a8,15 | |
> def self.options=(options) | |
> @@options = options | |
> end | |
> | |
> def self.options | |
> @@options ||= {} | |
> end | |
> | |
261a270,275 |
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 | |
# Now one can define models this way: | |
class Test < Sequel::Model(Sequel::Model.db, :implicit_dataset => false) | |
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
37c37,38 | |
< def self.Model(source) | |
--- | |
> def self.Model(source, params={}) | |
> Model.options = params |