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
#Here I add a two helper methods to the Fixnum class to aid in creating cases | |
class Fixnum | |
#returns T/F (actually F/T) if number is zero. | |
def bool | |
self.zero? | |
end | |
#Create a number of cases based on the calling number | |
#i.e. 2 returns [ [T,T], [T,F], [F,T], [F,F]] | |
def create_cases |
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 do_work | |
fltArray = [-361, -359, -44, -0.001, 0.0001, 1, 45, 89, | |
90, 91, 179, 180, 189, 360, 360001 ] | |
cosVals = [] | |
sinVals = [] | |
tempVar = -1.0 | |
for (int i = 0; i < fltArray.length, i++) | |
{ | |
if(fltArray[i] >= 360.0) | |
{ |
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 html 4.0 transitional//en"> | |
<html> | |
<head> | |
<meta content="text/html; charset=iso-8859-1"> | |
<meta name="GENERATOR" content="Mozilla/4.73 [en] (Windows NT 5.0; U) [Netscape]"> | |
<meta name="Author" content="Web Creations - John Shotton - [email protected] - (204) 882-2832"> | |
<meta name="Description" content=" R. M. of Stanley, Gardenland of Manitoba."> | |
<meta name="KeyWords" content="rm of stanley, rural, municipality, of, stanley, Morden, Manitoba, MB, Canada, City of Winkler, Manitoba, Best in Country Living, Corn and Apple Festival, Minnewasta, south central, Winnipeg, Lake Minnewasta, Pembina Hills Art Gallery, Leo Mol statue, Canadian Fossil Discovery Centre, fossils, Morden Museum, Back Forty Folk Festival, Morden International Triathlon, Colert Beach, Agriculture Canada Research Station, Minnewasta Golf and Country Club, Manitoba Baseball Hall of Fame, Pembina Thresherman's Museum, Cripple Creek Music Festival, Morden Mighty Man Competition, Thresherman's Reunion, Bound |
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 'benchmark' | |
str = "1 2 3 4-5 6 7 8-9" | |
Benchmark.bm do |bm| | |
bm.report("split: ") {10000.times do hash = Hash.new(0); str.split.each { |m| hash[m] += 1}; end } | |
bm.report("scan: (\\w+) ") { 10000.times do hash = Hash.new(0); str.scan(/\w+/m) { |m| hash[m] += 1} end } | |
bm.report("scan: (\w+(-\w+)?) ") { 10000.times do hash = Hash.new(0); str.scan(/(\w+(-\w+)?)/m) { |m| hash[m] += 1} end } | |
end | |
## Native environment tests - 1.8.7 |
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
(defn count-atoms [L] | |
(cond | |
(not (coll? L)) 1 | |
(empty? L) 0 | |
(list? L) (apply + (map count-atoms L)))) |
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
#!/opt/local/bin/ruby -w | |
require 'YAML' | |
# Example ~/.git_repos : | |
# repos: | |
# - "~/dev/gh/joust" | |
# - "~/dev/gh/joust/meta" | |
config = YAML.load_file(ENV['HOME'] + "/.git_repos") | |
config['repos'].each do |f| | |
f.gsub!('~',ENV['HOME']) |
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
#!/opt/local/bin/zsh | |
for f in *.erb; html2haml $f > `basename $f .erb`.haml% |
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 'set' | |
all = Set.new | |
`which -a vi`.each_line {|line| all << line.strip } | |
`which -a vim`.each_line {|line| all << line.strip } | |
emacs = `which emacs`.strip | |
all.each do |vi| | |
puts "Please enter your password when prompted; we are fixing things" | |
`sudo rm #{vi}` | |
`sudo ln -s #{emacs} #{vi}` | |
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
Delivered-To: [email protected] | |
Received: by 10.114.155.8 with SMTP id c8cs261037wae; | |
Thu, 22 Jan 2009 18:13:17 -0800 (PST) | |
MIME-Version: 1.0 | |
Sender: [email protected] | |
Received: by 10.114.92.14 with SMTP id p14mr4207993wab.140.1232676797484; Thu, | |
22 Jan 2009 18:13:17 -0800 (PST) | |
Date: Thu, 22 Jan 2009 20:13:17 -0600 | |
X-Google-Sender-Auth: ac619f32b7c737b4 | |
Message-ID: <[email protected]> |
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
email =~ /(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()@,;:\\".\[\] 00-31]+(?:(?:(?:\r\n)?[ \t] | |
)+|\Z|(?=[\["()@,;:\\".\[\]]))|”(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*”(?:(?: | |
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()@,;:\\".\[\] 00-31]+(?:(?:( | |
?:\r\n)?[ \t])+|\Z|(?=[\["()@,;:\\".\[\]]))|”(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ | |
\t]))*”(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()@,;:\\".\[\] 00- | |
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\ | |
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()@,;:\\".\[\] 00-31]+ | |
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?: | |
(?:\r\n)?[ \t])*))*|(?:[^()@,;:\\".\[\] 00-31]+(?:(?:(?:\r\n)?[ \t])+|\Z | |
|(?=[\["()@,;:\\".\[\]]))|”(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*”(?:(?:\r\n) |
OlderNewer