Showing posts with label #songsincode. Show all posts
Showing posts with label #songsincode. Show all posts

Thursday, 23 December 2010

#CarolsInCode - Top Five Countdown

#carolsincode
#CarolsInCode is a programming meme with a seasonal twist. Short programs are used to encode the lyrics of a Christmas carol. Some display the lyrics when the program runs while the more ingenious examples define the song with the program's control structures.

For example in JavaScript:

while ( shepherds.watch() == 'flocks' &&
  date.getHours() in night )
{
  lord.angel--;
  glory.shone_around();
}

This is While Shepherds Watched Their Flocks by Nahum Tate:

“While Shepherds watch their flocks by night,
All seated on the ground,
The angel of the Lord came down,
And glory shone around.”

Here's the top five countdown of the very best #CarolsInCode. Can you identify all five? Is your favourite missing?

GrumpyWookie:

Weather.Outside="frightful";
Fire.Delightful=true;
Lights.Luminosity=WayDownLow;
for (int i=1; i<=3; i++) { LetItSnow(); }

ShinyEmptyHead:

public Sleigh sleigh;
public void dashThroughSnow()
{
int horses = 1;
sleigh = new Sleigh(horses);
for (Field field : fields)
{
laugh();
}
}

JohnGirvin:

var wenceslas = new Person({
    rank: 'king',
    alignment: 'good'
});
$.bind(FeastOfStephen, function() {
    wenceslas.lookOut();
});

Costall:

if (DateTime.Now()=="25/12/2010")
{
for (i=0;i<3;i++) Ship[i].Visibility = Visibility.Visible;
}

GrumpyWookie:

Kiss.PersonA="Mummy";
Kiss.PersonB="Santa";
Kiss.Witness=Me;
Kiss.Location=Mistletoe.Underneath;
Kiss.Time=Date.LastNight;

More #CarolsInCode




#songsincode, lyrics for programmers

Friday, 17 December 2010

#carolsincode - Christmas for Programmers

#carolsincode
#carolsincode are small pseudo-programs which contain a Christmas song. Some examples display the lyrics while others use the program's control structures to define the song.

Here are five examples in C, CSS and JavaScript. Can you do better? ;-)

var kings=new Array(3);
for (x in kings)
{
  kings[x].origin='orient';
  kings[x].bearingGift=true;
  kings[x].travelled='afar';
}

main() {
  int a;
  for (a=1;a<5;a++) printf("Noel, ");
  printf("Born is the King of Israel.");
}

#rudolf .nose {
  color: red;
  background: url('very_shiny.jpg');
}

while ( shepherds.watch() == 'flocks' &&
  date.getHours() in night )
{
  lord.angel--;
  glory.shone_around();
}

for ( c=1, c<=4, c++)
{
  noel()
};
king = new Object();
king.kingdom = 'Israel';

Thursday, 10 September 2009

#songsincode - Lyrics for Programmers

#songsincode#songsincode are small pseudo-programs which display a song title or part of the lyrics. The more refined examples use conditional code and control stuctures to define the song.

The tag was first used on twitter a couple of weeks ago. After a sudden burst of popularity, #songsincode has slowed to about 20 tweets a day. Here's an example by testydonkey:

if(Door.Color == System.Color.Red)
{ Door.Color = System.Color.Black; }

This is Paint it Black by the Rolling Stones, “I see a red door and I want it painted black”.

Here's the top 25 countdown of the very finest #songsincode. Can you identify all 25? Is your favourite missing? Let me know :-)

anurse:
var s = new Submarine(Color.Yellow);
s.Residents.Add(Us); for(int i=0;i<2;i++)
{Assert.IsTrue(s.Color == Color.Yellow);}

darrennisbett:
h=new hotel(); h.name="california";
h.guest.addEvent("checkout");
h.guest.removeEvent("leave")

royvanrijn:
if(grass=="green" && girls == "pretty")
{ takeMe(paradiseCity); }

injenierobarsa:
for (int i = 1; i <= 99; i++)
{ redBalloons[i].goBy() }

3d0:
if(my.sexyness>shirt.sexyness) pain();

phikachu:
me.color = 0x0000FF;
me.text = “Da Ba Dee Da Ba Di”;

Borisson:
($horse_name == false ? $location = desert : ' ');

plaxdan:
self.vehicle = new CombineHarvester();
you.setKey(vehicle.getKey());

cargoweasel:
SubwayWalls.write(words_of_the_prophets());

Leadhyena:
I.send("...---...",world);
I.send("...---...",world);
while(!(someone.receive(bottle)&&
bottle.contains(message)){I.hope()}

antallan:
substring("the tiger",6,1)

pitsk:
void shootPeople() { shootSherif; return;
shootDeputy; }

sbruchmann:
if ($angelsDeserveToDie) { iCry(); }

royvanrijn:
while( !me.like(mondays) ) { tellWhy(me); }

Levistica:
cuts.firstElement().deepness = max;

uberTof:
final--;

plaxdan:
while (thing != that) { doForLove(thing);

numptygeek:
jumpWithDirection(left); stepWithDirection(right);

CarstenHagemann:
$jealous_sky[$sun] = $you->tell()
if ($we->walk($fields_of_gold));

numptygeek:
if(somethingStrange==true && location ==
neighborhood){ ghostbusters();
printf("I ain't afraid of no ghost");}

draconum:
//roxanne.putOnLight('#ff0000');
commented out, was not necessary

brozow:
video$ kill -9 `ps -ef | grep radio*`

rennyhernandez:
stuff={'red door','a line of cars', 'my heart'}
stuff.each do |it| it.setColor('#000000') end

codepo8:
.clowns{float:left;}.jokers{float:right};
#me_you{position:fixed;margin:0 auto;width:100%}

royvanrijn:
for(Leaf leaf:leafs)
{ leaf.setColor(new Color(139,69,19)); }
sky.setColor(Color.GRAY);

#moviesincode, #tvincode, #booksincode!


#songsincode has inspired three new tags. Can you see #moviesincode, #tvincode or #booksincode catching on? :-)

sijmen:
TypeError: Result of expression this.spoon'
[undefined] is not an object

rhizomecowboy:
trace(isNAN(prisoner));

nail7:
var i = count(MonteChristo);

#songsincode, lyrics for programmers