views:

527

answers:

22

Happy Christmas/[enter your festivity here] everyone!

perl -e '$a="How does stAckoverflow PeoPle implement \"happY Holiday\" prOgrams in Language of theIr choice toDAY, chriStmas eve?"; $a=~ tr/[A-Z]//cd; print $a;'
A: 

Delphi:

const
  cMyHoliday = 'XMas';

type
  EHappy = class (Exception);


procedure TMyMainWindow.OnActivate;
begin
  raise EHappy.CreateFmt('Happy %s', [cMyHoliday]);
end;
Gamecat
+2  A: 

C#

for(int i=0; i<3; i++)
{
  if(i!=0) Console.Write(", ");
  Console.Write("ho");
}
Console.WriteLine("!");
Sean
A: 

C++

# include<iostream>

using namespace std;

int main()
{
    cout<<"Wish you Merry Xmas and Happy New year";
    return 0;
}
Raghu
+2  A: 
select 'Merry Christmas';
@StingyJack: apparently, but the point is to title the entry, like others.
PhiLho
In Oracle you'd need to add a "from dual" clause.
Jon Ericson
A: 
public enum Holiday
{
  Easter,
  Xmas
}
public enum WishType
{
  Happy,
  Merry,
  Crappy
}
public string Wish(Holiday holiday, WishType wishType)
{
  Console.WriteLine("{0} {1}!", wishType.ToString(), holiday.ToString());
  RealLife.GetDrunk();
}
public class RealLife
{
  public static void GetDrunk()
  {
    System.Threading.Thread.CurrentThread.Suspend();
  }
}

Edit: forgot formatting :)

A: 

Ruby:

3.times { print 'Ho! ' }
PEZ
+1  A: 

Ruby

p "Merry Christmas"
fizzer
but not my favorite language
fizzer
+5  A: 

Lua

local l = { ' ', 'a', 'd', 'H', 'i', 'l', 'o', 'p', 's', 'y' }
local p = { 4, 2, 8, 8, 10, 1, 4, 7, 6, 5, 3, 2, 10, 9 }
local s= {}
for i, v in ipairs(p) do
  s[#s + 1] = l[v]
end
print(table.concat(s))
PhiLho
+1 for obscurity ;)
Robert Gould
+1 for a good Lua example
StingyJack
These are the point: that's a silly little code with no goal (neither good encryption/obfuscation nor optimization), just following a whim.
PhiLho
+5  A: 

Python:

list = ['Naughty', 'Nice', "Can't decide"]
for i in ['once', 'twice']:
  for behavior in list:
    assert(behavior is not None)

("He's making a list, and checking it twice")

Less verbose:

all([b is not None for b in ['Naughty', 'Nice', "Can't decide"]] * 2)
PEZ
Looks like it's only checking it once. Naughty.
Darius Bacon
Naughty indeed. Thanks!
PEZ
A: 

Function for SOAP Web Service in VDF.

{ Published = True  }
{ Description = "Is it xmas day ma?"  }
Function isItXmasDay Returns Boolean
    String sTmp
    Sysdate sTmp

    If (Left(sTmp,5)) eq "25/12" Function_Return (True)
    Else Function_Return (False)
End_Function
seanyboy
+2  A: 

Python:

from xmas.tidings import comfort, joy
Ali A
+6  A: 
10 PRINT "MERRY CHRISTMAS"
20 GOTO 10

(B.A.S.I.C.)

Ali A
I typed this in and now I can't stop my machine!!!1!!! Plz help.
fizzer
(No, not really)
fizzer
A: 

C++ & Boost

of course you use:

 boost::xmas<boost::xmas::policy::merry> merryXmas;
 merryXmas << "ho! ho! ho!";
Robert Gould
A: 

PHP, with as much evil as I can fit in:

<?
@mysql_connect('db', 'user', 'pass');
$sql = "SELECT text FROM messages WHERE text LIKE '%$message%'";
$query = @mysql_query($sql);
$row = @mysql_fetch_array($sql);
@echo $row[text];
?>
<form action="<?=$PHP_SELF ?>">
<input type=hidden name=message value="Merry Xmas!">
<input type=submit>
</form>
Ant P.
You forgot to disable error_reporting() on purpose. And your HTML is somewhat valid (as a fragment).
Adriano Varoli Piazza
The goggles! They do nothing!
Gareth
+1  A: 

I'd write one in the D Programming Language, but I'm not sure if I should use std.xmas or tango.Christmas.Merry… ;)

porneL
+2  A: 

XSLT for checking the list (twice):

<xsl:template match="/">
  <xsl:call-template name="check"/>
  <xsl:call-template name="check"/>
</xsl:template>

<xsl:template name="check">
  <xsl:apply-templates select="children/child"/>
</xsl:template>

<xsl:template match="child[@good='true']>
  <xsl:value-of select="@name"/>: present
</xsl:template>

<xsl:template match="child[not(@good='true')]>
  <xsl:value-of select="@name"/>: coal
</xsl:template>
Marc Gravell
I better watch out!
PEZ
A: 
(defun xmas()
 (cons 'merry 'xmas))
fmsf
+1  A: 

(several languages in the Java-like family)

World.joy();

and

public abstract class Earth {
    public Object peace();
}
joel.neely
+1 for filantropy.
PEZ
[world joy] in Objective-C
Adam Rosenfield
+1  A: 

f#

let printMessage m =
 match m with
 |"holiday" -> printfn "%A" "Happy holidays"
 |"xmas" -> printfn "%A" "Happy Xmas"
 | _ -> printfn "%A" "Nothing to celebrate"


printMessage "holiday"
Dang, you just beat me to it!
Jacob Adams
A: 

F#

let concat (x : string) y = x + y;;
printfn "%s" concat "Happy, " "Holidays!";;
Jacob Adams
A: 

Obfuscated Perl:

echo 'qw{39 4 17 17 24 26 29 7 17 8 18 19 12 0 18 };' |
perl -E'local*~=sub{[a..z," ",A..Z]->[$_]};print&~()for eval<>;say'

To figure out what to have for the echo:

echo Merry Christmas |
perl -E'$h{$_}=$c++for(a..z," ",A..Z);push@a,$h{$_}for(split"",<>);say"qw{@a};";'
Brad Gilbert
That's so obfuscated it doesn't work. This does: echo 'qw{39 4 17 17 24 26 29 7 17 8 18 19 12 0 18 };' | perl -e 'local*~=sub{[a..z," ",A..Z]->[$_]};printsay'
Jon Ericson
I never actually ran it like this. When testing, I just outputted the generating script, directly into the printing script. (fixed)
Brad Gilbert
+3  A: 
#include <iostream>
typedef unsigned a;a s[]={0,0xab29de8f,0x731b3bb3,0xd3726395,0x6b9874bd,0xb531ccea,0xb27532d4,0x659b3b25,
0x6531ccca,0x9994ca66,0xab294dc9,0x99999c93,0x7a96a5a9,0x67a4be4c,0x1cccea71,0x4ca66653,0xd6c97c9d,
0xc733a9bd,0x3299994c,0x98e5f275,0x725eeafb,0x99d4def7,0xa94a53a9,0x2a4bb999,0xccf49893,0xa6653294,
0xc94ecccc,0xcea6f6e4,0x531ccccc,0xbb224a37,0xea653335,0xb3a994cc,0x6a7cee51,0xa6675312,0xa9994cce,
0x6b93251b,0xd91cea5d,0x772ab4f4,0xcb64d5be,0xd2cd71b9,0x6d6c972c,0x7b75b25f,0x129f93b2};
a g(a&d,a*&c,a b){a v=0;for(a i=0;i<b;++i,d<<=1){if(!d)d=1,++c;if(*c&d)v|= 1<<i;}return v;}
int main(){char p=32;for(a i=0,*t=s,m=0,s=0;i<1760;++i,--s,std::cout<<p)if(!s)p^=3,s=g(m,t,g(m,t,3));}

Skizz

Skizz