84
u/Code_For_Food Dec 02 '14 edited May 08 '15
10
u/trevorsg Dec 02 '14
Yeah, and it's also not counting those strange cultures that start the week on Monday instead of Sunday.
14
4
u/Fingebimus Dec 02 '14 edited Dec 03 '14
What stupid cultures start the week on Sunday?
10
u/imsometueventhisUN Dec 02 '14 edited Dec 03 '14
Most of them, because that's the International Standard. You're not in /r/murica here.
EDIT: I'm a fool who should read comments before I type, especially when they're as vitriol-laden as this. I misread the above as "don't start the week on Sunday". Humiliation and contrition abound.
3
u/DownvoteMeHarder Dec 02 '14 edited Dec 03 '14
I live in the US and the first day of the week is pretty unanimously Monday, I've never met anyone who thinks otherwise actually.
1
u/imsometueventhisUN Dec 03 '14
You're completely right - I misread the comment (see my edit!) - sorry!
2
u/autowikibot Dec 02 '14
Section 11. Week numbering of article Seven-day week:
Weeks in a Gregorian calendar year can be numbered for each year. This style of numbering is commonly used (for example, by schools and businesses) in some European and Asian countries, but rare elsewhere.
ISO 8601 includes the ISO week date system, a numbering system for weeks – each week begins on a Monday and is associated with the year that contains that week's Thursday (so that if a year starts in a long weekend Friday–Sunday, week number one of the year will start after that). For example, week 1 of 2004 (2004W01) ran from Monday 29 December 2003 to Sunday, 4 January 2004, because its Thursday was 1 January 2004, whereas week 1 of 2005 (2005W01) ran from Monday 3 January 2005 to Sunday 9 January 2005, because its Thursday was 6 January 2005 and so the first Thursday of 2005. The highest week number in a year is either 52 or 53 (it was 53 in the year 2004). Schematically, this ISO convention translates as follows:
In some countries, though, the numbering system is different from the ISO standard. At least six numberings are in use:
Interesting: ^Week | Javanese ^calendar | Akan ^calendar
Parent commenter can toggle ^NSFW or ^delete. Will also delete on comment score of -1 or less. | FAQs | ^Mods | Magic ^Words
1
u/yawkat Dec 03 '14
That looks more like half-half between Sunday and Monday, and iso says Monday too.
1
u/imsometueventhisUN Dec 03 '14
You're completely right - I misread the comment (see my edit!) - sorry!
1
0
Dec 02 '14
[deleted]
34
u/aidirector Dec 02 '14
You need to instantiate a Clergy object via ClergyFactory to mediate your prayers.
ClergyFactory clergyFactory = ClergyFactory.getInstance(religion); clergyFactory.setLocale("en"); clergyFactory.setLocaleSub("us"); Clergy clergy = clergyFactory.getClergy(); thanksGiver.petition(clergy, god); thanksGiver.giveThanksTo(clergy);7
u/mahlzeit Dec 03 '14
There's a potential problem in your code, you need to catch the
NeedAltarBoyException(especially if you're using aReligiousDenomination('catholic')object).2
16
Dec 02 '14
If this was C#, then method
giveThanksTowould be accepting interfaceIGodsImagewhich has derived classesGodandMan(andWoman, which has to be instantiated with aRibdependency).2
u/the_omega99 Dec 03 '14
This is obviously a case for the actor model.
god ! "Thanks for the Friday, dude"(Valid Akka code, by the way.)
2
1
1
u/edave64 Dec 03 '14
Your ruby code gives god to the Thanks, what ever that means. You would need to specify a sender, like in your Java example. You also converted all christians to catholics. And your interface cannot be used for polytheistic religions
0
11
Dec 02 '14
And the LORD said "return zero", and it was good.
(first thing I could think up, carry on)
24
u/DynaBeast Dec 02 '14
if DateTime.now.day == "friday" then
God.thank()
endAssuming lua, of course.
1
0
0
Dec 02 '14
[deleted]
1
u/DynaBeast Dec 02 '14
You could've looked it up, but no; it doesn't. '==' is practically '.equals()' anyway, since that's how the interpreter is set up. If you want an equivalent to '==' from another language, then the 'is' keyword in Python is what you're looking for.
0
Dec 03 '14
[deleted]
2
u/Tysonzero Feb 25 '15
(I realise I am 2 months late, was browsing top) I totally agree. I have very few complaints when it comes to Python. It is an awesome language. The one thing I sometimes miss (depends on the type of app) is static typing. But it seems like CPython has that stuff anyway. That and the GIL can be annoying for certain programs. But besides that everything is awesome.
8
22
u/faldborg Dec 02 '14
It is the idiom "thank god it is friday" in a smalltalk dialect I have never seen before. Quite idiomatic in fact. I am impressed.
64
u/HorizonShadow Dec 02 '14
I believe it's Ruby.
36
u/Ark_Tane Dec 02 '14
Yep, and looks perfectly valid to me. DateTime#friday? is even part of the standard library. Not quite sure why God#thank! needs a !, perhaps it raises an exception if the environmnet is an atheist.
33
u/agent766 Dec 02 '14
From what I understand, Thank would probably modify God instead of returning a new God. Imagine if a new God was made every time someone thanked him!
10
u/Ark_Tane Dec 02 '14
It's a class method though (should have written God::thank! instead), as a result I can only assume we're looking at a singleton class.
14
u/aidirector Dec 02 '14
Singleton pattern is only valid for monotheistic religions. This won't scale!
4
19
u/Mustermind Dec 02 '14
!is a common convention in ruby that indicates that a method will cause a permanent change. For example:a = "hello" b = a.gsub("e", "3"); puts a, b # returns "hello" and "h3llo" a = "hello" b = a.gsub!("e", "3"); puts a, b # returns "h3llo" and "h3llo"So, I'm guessing you can't unthank God after you thanked him...
14
u/curtmack Dec 02 '14 edited Dec 02 '14
For those wondering: Ruby has a lot of features for both functional and imperative programming, and it's designed to be easy to tell which one you're doing at any given time. Thus, methods that inherently modify state are clearly marked as such, by ending with a
!.This is also why predicate methods (i.e. methods that return a boolean) end in
?, to make it easy to tell that they can be used in functional constructs like filters.2
7
6
u/imadeofwaxdanny Dec 02 '14
I do believe so because of the ? and !. Although, I believe the ruby way of writing it would be
God.thank! if DateTime.now.friday?1
4
3
u/nakilon Dec 02 '14
It is Ruby + ActiveSupport.
5
3
2
2
1
1
Dec 14 '14
import Data.Time.LocalTime
import Data.Time.Format
import System.Locale
import Data.Char
data Weekday = Sun|Mon|Tue|Wed|Thu|Fri|Sat deriving (Show, Enum)
getDayInt = formatTime defaultTimeLocale "%w"
intToWeekday = (!!) [Sun .. Sat]
tgif Fri = sendTo "Elohim" "Thanks"
tgif _ = return ()
-- We haven't figured out how to make this type-safe
-- so we're just mocking it....
sendTo user mess = putStrLn (user ++ ": " ++ mess)
main = getZonedTime >>= tgif . intToWeekday . digitToInt . head . getDayIntSometimes it's really hard to stand up for your favorite language.
-4
-7
0
179
u/[deleted] Dec 02 '14
Help! After reading this I forgot how to code and I am going to be fired. What can I do?