Skip to content

Instantly share code, notes, and snippets.

Douglas G. Allen DouglasAllen

Block or report user

Report or block DouglasAllen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View my_lambda.rb
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}
}
View from_r_aa2.rb
require 'date'
include Math
D2R = PI / 180.0
R2D = 180.0 / PI
def jc(jd)
(jd - 2_451_545) / 36_525.0
end
View from_r_aa.rb
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
@DouglasAllen
DouglasAllen / vowels_consonants_counter.c
Created Feb 11, 2017
C main program takes a string input and counts the number of vowels and consonants.
View vowels_consonants_counter.c
//**************************************
// 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.
//
@DouglasAllen
DouglasAllen / sunrise.cpp
Last active Feb 11, 2017
Qt Sunrise author unknown appears to be based upon the Wikipedia sunrise equation
View sunrise.cpp
#include <QtCore>
#include "sunrise.h"
Sunrise::Sunrise(double latitude_, double longitude_, double elevation_)
: latitude(latitude_)
, longitude(-longitude_)
, elevation(elevation_)
{
View rose_sketch.js
// 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;
@DouglasAllen
DouglasAllen / simple_rose.rb
Created Feb 10, 2017
This will run in Ruby Shoes only. see... http://shoesrb.com/
View simple_rose.rb
# 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
@DouglasAllen
DouglasAllen / SolarInfo.cs
Created Oct 14, 2016 — forked from cstrahan/SolarInfo.cs
A sunrise/sunset calculator.
View SolarInfo.cs
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; }
View blog_template.rb
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!"
View method_call.rb
# method_call.rb
def hello
"Hello there!"
end
hi = method :hello
def say mo
mo.call
You can’t perform that action at this time.