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' | |
date = DateTime.now | |
jd = date.jd | |
t = (jd - 2_451_545.0) / 36_525.0 | |
ma = [1287104.793048, 129596581.0481, - 0.5532, 0.000136, - 0.00001149] | |
@horner = lambda { |t, abc| | |
abc.each_with_index.reduce(0){|a, (e, i)| a + e * t**i} | |
} |
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' | |
include Math | |
D2R = PI / 180.0 | |
R2D = 180.0 / PI | |
def jc(jd) | |
(jd - 2_451_545) / 36_525.0 | |
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
require 'date' | |
include Math | |
D2R = PI / 180.0 | |
R2D = 180.0 / PI | |
def gml_sun(jc) | |
(280.46646 + jc * (36_000.76983 + jc * 0.0003032)) % 360.0 | |
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
//************************************** | |
// Name: vowels_consonants_counter.c | |
// Description: | |
// Consonants and Vowels Counter in C | |
// A sample program that will ask the user to enter a work or | |
// a sentence and then the program will count how many consonants and | |
// vowels in a given word or sentence by the user. | |
// Take note I am using Turbo C 2.0 For DOS as my C compiler in this program. | |
// |
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
#include <QtCore> | |
#include "sunrise.h" | |
Sunrise::Sunrise(double latitude_, double longitude_, double elevation_) | |
: latitude(latitude_) | |
, longitude(-longitude_) | |
, elevation(elevation_) | |
{ | |
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
// Daniel Shiffman | |
// http://codingtra.in | |
// Mathematical Roses | |
// Video: https://youtu.be/f5QBExMNB1I | |
// Based on: https://en.wikipedia.org/wiki/Rose_(mathematics) | |
var d = 8; | |
var n = 5; | |
var sliderD; | |
var sliderN; |
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
# could be the start of a nice spirograpgh program | |
# require 'green_shoes' | |
Shoes.app height: 820, width: 1420, title: ' Roseland Revisited' do | |
background black | |
@center_y = height / 2 | |
@center_x = width / 2 | |
@radius = @center_x / @center_y * @center_x | |
para @radius.to_s |
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
using System; | |
using System.Diagnostics; | |
namespace SunriseCalculator | |
{ | |
public class SolarInfo | |
{ | |
public double SolarDeclination { get; private set; } | |
public TimeSpan EquationOfTime { get; private set; } | |
public DateTime Sunrise { get; private set; } |
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
project :test => :shoulda, :renderer => :haml, :stylesheet => :sass, :script => :jquery, :orm => :activerecord | |
#default routes | |
APP_INIT = <<-APP | |
get "/" do | |
"Hello World!" | |
end | |
get :about, :map => '/about_us' do | |
render :haml, "%p This is a sample blog created to demonstrate the power of Padrino!" |
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
# method_call.rb | |
def hello | |
"Hello there!" | |
end | |
hi = method :hello | |
def say mo | |
mo.call |
NewerOlder