March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 deletions

View file

@ -0,0 +1,38 @@
Calendar(Yr){
LastDay := [], Day := []
Titles =
(ltrim
______January_________________February_________________March_______
_______April____________________May____________________June________
________July___________________August_________________September_____
______October_________________November________________December______
)
StringSplit, title, titles, `n
Res := "________________________________" Yr "`r`n"
loop 4 { ; 4 Vertical Sections
Day[1]:=Yr SubStr("0" A_Index*3 -2, -1) 01
Day[2]:=Yr SubStr("0" A_Index*3 -1, -1) 01
Day[3]:=Yr SubStr("0" A_Index*3 , -1) 01
Res .= "`r`n" title%A_Index% "`r`nSu Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa"
loop , 6 { ; 6 Weeks max per month
Week := A_Index, Res .= "`r`n"
loop, 21 { ; 3 weeks times 7 days
Mon := Ceil(A_Index/7), ThisWD := Mod(A_Index-1,7)+1
FormatTime, WD, % Day[Mon], WDay
FormatTime, dd, % Day[Mon], dd
if (WD>ThisWD) {
Res .= "__ "
continue
}
dd := ((Week>3) && dd <10) ? "__" : dd, Res .= dd " ", LastDay[Mon] := Day[Mon], Day[Mon] +=1, Days
Res .= ((wd=7) && A_Index < 21) ? "___" : ""
FormatTime, dd, % Day[Mon], dd
}
}
Res .= "`r`n"
}
StringReplace, Res, Res,_,%A_Space%, all
Res:=RegExReplace(Res,"`am)(^|\s)\K0", " ")
return res
}

View file

@ -0,0 +1,15 @@
Gui, font,s8, COURIER
Gui, add, edit, vYr w40 r1 Limit4 Number, 1969
Gui, add, edit, vEdit2 w580 r38
Gui, Add, Button, Default Hidden gSubmit
Gui, show
Submit:
Gui, Submit, NoHide
GuiControl,, Edit2, % Calendar(Yr)
return
GuiEscape:
GuiClose:
ExitApp
return

View file

@ -1 +1,37 @@
$_=$ARGV[0]//1969;`cal $_ >&2`
#!/usr/bin/perl
use strict;
use warnings;
use Time::Local;
my @names = qw/ JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC/;
my $year = shift ||'2007';
for my $month (0..11) {
print " $names[$month] $year\n";
print calendar($year, $month), "\n\n";
}
sub calendar {
my ($year, $month) = @_;
my @mon_days = qw/31 28 31 30 31 30 31 31 30 31 30 31/;
++$mon_days[1] if $year % 4 == 0 && ($year % 400 == 0 || $year % 1
+00 != 0);
my $cal = " Sun Mon Tue Wed Thu Fri Sat\n";
# Months are indexed beginning at 0
my $time = timegm(0,0,0,1,$month,$year);
my $wday = (gmtime $time)[6];
$cal .= " " x $wday;
my $mday = 1;
while ($mday <= $mon_days[$month]) {
$cal .= sprintf "%4s", $mday++;
$cal .= "\n" if ($wday + $mday -1) % 7 == 0;
}
return $cal;
}
# Let's use this as a placeholder until a better solution arrives, OK?

View file

@ -37,7 +37,8 @@ array make_month(object month, int field_width, void|string region)
if (region)
holidays = Calendar.Events.find_region(region)->scan_events(month);
array weekday_names = sprintf("%*.*s", field_width, field_width, month->week()->days()->week_day_shortname()[*]);
array weekday_names =
sprintf("%*.*s", field_width, field_width, month->week()->days()->week_day_shortname()[*]);
out += ({ ({ month->month_name(), month->month_no(), month->year_name() }) });
out += ({ weekday_names });