Skip to content

Instantly share code, notes, and snippets.

@makenowjust
Created October 23, 2014 15:07
Show Gist options
  • Save makenowjust/ff73bf25888d18886985 to your computer and use it in GitHub Desktop.
Save makenowjust/ff73bf25888d18886985 to your computer and use it in GitHub Desktop.
プロ生ちゃん #カレンダープログラミング プチコンテスト 2014。Ruby & PythonのPolyglotなコードです(2つファイルがありますがどちらも同じ内容です)
"""#{require'date';D=Date;t=D.today;s='';
(x=D.new(t.year,t.month,1).cwday%7).times{s<<' '};
D.new(t.year,t.month,-1).day.times{|i|i+=1;s<<(i<10?' ':'')<<i.to_s<<
((x+i)%7==0??\n:' ')}; puts s;exit}""";__END__=0;1//2
from calendar import *; from datetime import *
setfirstweekday(6);t=datetime.today()
print("\n".join(month(t.year,t.month).split("\n")[2:])[: -1])
#/.hash
"""#{require'date';D=Date;t=D.today;s='';
(x=D.new(t.year,t.month,1).cwday%7).times{s<<' '};
D.new(t.year,t.month,-1).day.times{|i|i+=1;s<<(i<10?' ':'')<<i.to_s<<
((x+i)%7==0??\n:' ')}; puts s;exit}""";__END__=0;1//2
from calendar import *; from datetime import *
setfirstweekday(6);t=datetime.today()
print("\n".join(month(t.year,t.month).split("\n")[2:])[: -1])
#/.hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment