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
# Calculate current Julian Cycle | |
=begin | |
=end | |
# Approximate Solar Noon | |
=begin | |
=end | |
# Solar Mean Anomaly | |
=begin | |
=end | |
# Equation of Center |
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
// terminal-2%> chuck + otf_01.ck | |
// (anytime later) | |
// terminal-2%> chuck + otf_02.ck | |
// (etc...) | |
//--------------------------------------| | |
// synchronize to period | |
.5::second => dur T; | |
T - (now % T) => 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
# ruby p017leapyearmtd.rb | |
input_year = 1895 | |
puts "The start year = #{input_year}" | |
require 'date' | |
year = input_year | |
while (year < 1910) do | |
date = Date.new(year) |
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 majority of this code is taken right out of the BigDecimal class proof | |
# from http://www.ruby-doc.org/stdlib-1.9.3/ | |
=begin | |
Decimal arithmetic is also useful for general | |
calculation, because it provides the correct | |
answers people expect-whereas normal binary | |
floating point arithmetic often introduces | |
subtle errors because of the conversion between |
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
```code | |
# Usage | |
# Set your time zone offset at the line tz =.... | |
# Mine is -5 hours use 5.5 if you're on a half hour offset. | |
# The latitude and longitude arguments are my coordinates. | |
# Yours are most likely different. | |
# If you are west of Greenwich meridian then use longitude negative. | |
# If you are south of the equator then use latitude negative. | |
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 'date' | |
time = Time.now.utc | |
puts time | |
year = time.year | |
month = time.month | |
day = time.day | |
puts DateTime.new(year, month, day).ajd * 1.0 | |
puts DateTime.new(year, month, day).ajd / 1.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
require 'solareventcalculator' | |
timezone = "America/Chicago" | |
latitude = 41.9474 | |
longitude = -88.74467 | |
today = Time.now.utc | |
date = "#{today.year}-#{today.month}-#{today.day}" | |
date = Date.parse(date) | |
puts | |
puts "Timezone = #{timezone}" |
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
# | |
# Shoes Clock by Thomas Bell | |
# posted to the Shoes mailing list on 04 Dec 2007 | |
# | |
# use http://www.celnav.de/longterm.htm to check it. Just pick a time enough ahead | |
# note GMST for that time then watch your clock. | |
require 'bigdecimal' | |
require 'date' |
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
# | |
# Shoes Clock by Thomas Bell | |
# posted to the Shoes mailing list on 04 Dec 2007 | |
# | |
require 'bigdecimal' | |
require 'date' | |
Shoes.app :height => 350, :width => 250, :title => "Sidereal Clock (GMST)" do | |
@radius, @centerx, @centery = 90, width / 2, height / 2 | |
animate(24) do | |
@timenow = Time.now.utc |
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
Shoes.app :title => "Block Redirection" do | |
stack do | |
para "First" | |
para "Second" | |
para "Third" | |
end | |
class Messenger | |
def initialize(stack) | |
@stack = stack |