RT @richardherries: #sublimetext 2's multiple cursors is freakishly powerful ctrl + cmd +g
RT @cdixon: Closing at opening price is fine. The risk here is what happens when underwriters stop propping it up.
RT @alex: Yo - Facebook raised billions at a valuation of >$100b - if you think that that was a 'disappointment,' you don't fucking get numbers.
RT @shervin: This is awesome. https://t.co/o0d3sz1b
RT @cdixon: The top 10 e-commerce sites has stayed the same for the last decade but top 10 non-e-commerce sites is completely different. Why?
RT @detectify: We've added file verification now. It's explained in our blog and will be added soon visually http://t.co/RGGUd2oB
RT @GSElevator: #1: I drive better drunk. I go the speed limit. I concentrate. And I don't use my Blackberry. n#2: The new S-class drives itself.
@avlidienbrunn RT @lifehacker: Is your phone's alarm not walking you up in the morning? http://t.co/kh
Z Kombinator Pokes Some Fun At Samwer Brothers http://t.co/BQHmrRIP
RT @marcoarment: First thought when seeing The New Yorker's cover: Is it about Google? (Then I figured it out.) http://t.co/lZIhHPYL
RT @jirafeinc: 3 Essential SEO Tips for Every Store Owner | http://t.co/RHcZEIlz
RT @montymunford: Poor old Vidal, I didn't expect him to go Sassoon.
RT @BarackObama: "Same-sex couples should be able to get married."—President Obama
RT @jirafeinc: Slow-loading Sites Cost Retailers £1.7b Globally in Lost Sales | http://t.co/pqFjUMYd
RT @SkatteverketSE: Glöm inte att trots att "Mange Bjuder" så behöver ni redovisa det, det är inte representation när det är "Fest hos Mange"
RT @UrMindBlown: Leonardo DiCaprio never died in Titanic. Last scene: him going underwater. 1st Scene in Inception: him waking up on a beach. 09.05.12 8.29 pm
RT @pvesterbacka: 1B. Done. #billionbirds
@Joakim dm'a mig dina kontaktdetaljer så kommer mer info på mejlen
RT @PhilipBattin: My @Spotify just "can't" http://t.co/z8o6oGRV
time 4 #nes12!
Nets, Abalon. Silk is just getting better..and better. Happy b-day Y/S!
RT @youngskilled: It's Y/S' birthday today. A 4 year old beauty pie. Cake and bee(f|r)! I am on a bike.
It's Y/S' birthday today. A 4 year old beauty pie. Cake and bee(f|r)! I am on a bike.
RT @BillGates: I was a paperboy, but Warren can throw a newspaper further than I can. I think he practiced. http://t.co/PeNgaHhs
RT @detectify: Great report on network security. http://t.co/5PPE1Wpq
RT @rupertmurdoch: Sorry, that was Greece!
RT @jugendingenieur: Video of OP-1 in Halo 4 soundscape: http://t.co/nSoQRZImnThanks @sotarotojim
@linkalertio wow cool service. So easy and so genius! I am signing up.
@twilfit hej! kan du höra av dig till mig. hälsningar marknad på twilfit
hey @MediaLoot! just bought Item #: 382 from your service. Didn't get the download. How come?
RT @DEVOPS_BORAT: In startup we are not allow dev team for talk to ops team except by API. @fransrosen
RT @DEVOPS_BORAT: In startup we are not allow dev team for talk to ops team except by API.
RT @Almroot: Remember Google's "zerg rush" easteregg? I think I can see a pattern here... http://t.co/zHpbLcnv
RT @deluxeroyale: How to influence google: http://t.co/kF8pOsQz
RT @deluxeroyale: How to influence google the movie: http://t.co/ncH9qKB2 Great soundtrack imo
RT @Almroot: Remember Google's "zerg rush" easteregg? I think I can see a pattern here... http://t.co/zHpbLcnv
RT @starcraft2_news: Detectify Inspired Google Easter Egg? http://t.co/RnueJ3ZW
RT @cdixon: We need someone to standardize privacy policies and terms of service a la Creative Commons.
RT @rupertmurdoch: Of course markets stay high with central banks printing huge sums, inflating everything except jobs.
RT @rupertmurdoch: Governments worldwide have borrowed 100 trillion last ten years. Defaults inevitable sometime soon. Means crash, hurting rich and poor.
Perfecting On-Page Optimization for Ecommerce Websites | SEOmoz http://t.co/llGx2geM
@Christianhagman Read this: http://t.co/lQ3DH8iR
Thanks @rhymesayers for this great gift. We are very excited to be able to give something back soon. http://t.co/giyk2X3T
RT @KimJongNumberUn: The press is reporting that my missiles are fake. Yeah, right - next they'll be saying this Twitter account is fake.
RT @hipsterhacker: The only way to tell the difference between an elite developer and a homeless person is his iPhone. The homeless guy probably has Android.
RT @kkowalcz: Quote of the day goes to @piotrpa for 'Don't worry, they're Polish, they're trying to help!' /cc @ 25.04.12 8.03 am
@Christianhagman https://t.co/AjEVrCF2 get ready!
At a startup "You build or you sell. There’s nothing else to do. "http://t.co/a2Yitvdv
We tend to have something we call Friday Challenges at Y/S. It's basically a small hackathon with a specific goal and a reward of some sort. The fun thing with these challenges tend to be the discussions afterwards and while doing the code review you can clearly see the differences in approach. You can also earn extra points if you do something spectacular or easteregg-ish.
Last week we had the following task:
"Numbers without magic numbers
Create a function that returns our office number: 4687203333
Extreme: Not using any standard constants nor strings/numbers.
Hard: Only using standard-functions/constants.
Medium: Without using any strings nor numbers. Think outside the box...
Easy: Only using the number 1.
You can use Javascript, Python or PHP.
The function should be called get_office_number() and should return the value as a string.
Good luck."
And, here's the results and solutions that we came up with.
1. David went with the extreme solution not using any contants/numbers nor strings.
<?
function get_office_number(){
$one = pi()/pi();
$two = $one+$one;
$four = $two*$two;
$base = floor(getrandmax()*(pi()-$one));
$base += str_repeat(($four*$two), $two).str_repeat(($one-$one), (($four*$two)-$two));
$base += pow($four, ($four*$two) + ($one) ) / $two;
$base += pow($four, ($four*$two) ) / $two;
$base += (pow($four, ($four + $two)));
$base += (pow($four, ($four-$one))) * ($two+$one);
$base += ($two + $one);
return $base;
}
echo get_office_number();
die;
2. Frans went insane and created a jibberish version of combined constants ad infinitum. He motivated it with "but it's an oneliner!", not sure that counts though...
<?
function get_office_number() {
return (PHP_INT_MAX+PHP_INT_MAX+((((((PHP_INT_MAX-UPLOAD_ERR_PARTIAL)/PHP_MINOR_VERSION/PHP_MINOR_VERSION)-E_ERROR)/PHP_MINOR_VERSION)-E_ERROR)/PHP_MINOR_VERSION*UPLOAD_ERR_PARTIAL))-PHP_VERSION_ID*PHP_RELEASE_VERSION*PHP_MINOR_VERSION*PHP_RELEASE_VERSION-PHP_VERSION_ID-PHP_VERSION_ID-PHP_VERSION_ID-PHP_VERSION_ID-PHP_VERSION_ID-PHP_VERSION_ID-PHP_VERSION_ID-(PHP_VERSION_ID/PHP_MINOR_VERSION)+E_USER_NOTICE+E_USER_ERROR+E_COMPILE_WARNING+E_CORE_WARNING-E_PARSE-UPLOAD_ERR_PARTIAL;
}
echo get_office_number();
3. Fredrik did a HAXX0R version. I think the code says it all...or does it?
<?
function get_office_number(){
$hax=@hax; $__=ord($hax)-ord($hax);
@$_[]=(@${__}); $__=((++$__)+$__++); $_[]=@${__}; $___=$__/$__;
$_[++$_[$___]]=$_[$___]+(($___<<$___<<$___)-($___<<$___)-$___); $_[$_[($_[($___<<$___<<$___)-$___]/($___<<$___<<$___))]]=@${__};
$_[$_[$___/$___]*$_[($___<<$___)+$___]]=--$__; $_[$_[(@${__})]+$__]=(count(@${_})); $_[$_[(@${__})]+(++$__)]=(((--$__)<<($__<<$__<<$__))/((@${__})+$__));
return ($_[($___<<$___<<$___)].($_[($___<<$___<<$___)+@${__}]-(++$__)).($_[($__<<$__)>>$___]*($___<<$___)).(($__<<$__<<$__>>($___<<$___))-(--$__)).($___<<$___).(--$__).str_repeat($_[($__++)+$___],$___<<($___<<$___)));
}
echo get_office_number();
4. Mathias did a bit shifting scenario, but actually failed, since he missed the last digit in our office number :<
<?
//IF not running >5.3
#define ('PHP_ROUND_HALF_UP', 1);
#define ('PHP_ROUND_HALF_DOWN', 2);
#define ('PHP_ROUND_HALF_EVEN', 3);
#define ('PHP_ROUND_HALF_ODD', 4);
function get_office_number(){
return ((PHP_ROUND_HALF_UP<<(((PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP) * PHP_ROUND_HALF_ODD)+(PHP_ROUND_HALF_ODD * PHP_ROUND_HALF_DOWN)))^(PHP_ROUND_HALF_UP<<(((PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP)+PHP_ROUND_HALF_ODD) * PHP_ROUND_HALF_EVEN))^(PHP_ROUND_HALF_UP<<((PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP) * (PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP)))^(PHP_ROUND_HALF_UP<<((PHP_ROUND_HALF_DOWN * PHP_ROUND_HALF_EVEN) * PHP_ROUND_HALF_ODD))^(PHP_ROUND_HALF_UP<<(((PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP) * PHP_ROUND_HALF_ODD) + PHP_ROUND_HALF_EVEN))^(PHP_ROUND_HALF_UP<<(((PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP) * PHP_ROUND_HALF_ODD) + PHP_ROUND_HALF_DOWN))^(PHP_ROUND_HALF_UP<<((PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_EVEN) * PHP_ROUND_HALF_EVEN))^(PHP_ROUND_HALF_UP<<((PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP) * PHP_ROUND_HALF_ODD))^(PHP_ROUND_HALF_UP<<(PHP_ROUND_HALF_ODD * PHP_ROUND_HALF_EVEN))^(PHP_ROUND_HALF_UP<<((PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP) + (PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP) + PHP_ROUND_HALF_UP))^(PHP_ROUND_HALF_UP<<((PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_UP)+PHP_ROUND_HALF_ODD))^(PHP_ROUND_HALF_UP<<(PHP_ROUND_HALF_ODD + PHP_ROUND_HALF_EVEN))^(PHP_ROUND_HALF_UP<<(PHP_ROUND_HALF_DOWN * PHP_ROUND_HALF_EVEN))^(PHP_ROUND_HALF_UP<}
echo get_office_number();
He also made an easteregg. If you count the characters in the function, it's 1337... nice one!
5. Richard/Desmond did a coder's collab. They followed the rules but the code required you to create a file named as the number you wanted as the output. Smallest amount of code, but required extra effort!
Place a file named '4687203333' inside the the same directory as the file below.
<?php echo get_office_number(); function get_office_number(){ $arr=scandir(getcwd()); array_shift($arr); array_shift($arr); $arr2=array_shift($arr); return $arr2; }
Together we announced Fredrik as the winner of the challenge. Congrats Fredrik!