To all who Think Themselves a Programmer
sfbay.craigslist.org
sfbay.craigslist.org
I hope that they ran this ad to stand out and be hip.
But just in case the people in this company are like the ad they are running, run, don't walk, the other way from these elitist snobs desperately in need of an attitude adjustment.
Here's my submission:
digits = [70,85,67,75,89,79,85];
for(i=0;i++;i<7){print chr(digits(i))};
I'm a Perl lover which argue that with Moose and CPAN, modern Perl is incredibly good for development in many cases.
But I must say that I never understood the idea of obfuscation in Perl. If you throw out coding standards, it is like tennis without a net. :-)
Edit: If I'd done it from scratch, I'd probably have gone with the curses lib, since it was such a long time since I last used it. (The japh stuff represents at least months of creativity by people that are both smarter and crazier than I am. Don't reinvent the wheel.)
print 'hell'
sleep 1500ms
print 'o'
for i=0->2
sleep 500ms
cursorleft = cursorleft-1
print o
sleep 700ms
print ' world' curl -s http://sfbay.craigslist.org/sfc/eng/1246353621.html | grep -ci "fail"
15Well, I guess with the crowd these guys are going for, maybe those terms don't really apply...
?
Because: that is who posted the ad; Stephen Blum, 'lead ninja engineer @ trusted opinion, inc'.
In what possible way is 'send us the coolest "hello world" you've got, and we'll critique your style' not an invitation to judge by appearance?
now think: how often do you see a job posting make the first page of HN? (one might say their prime sort of recruitment site...)
I'm going with calling them savvy :)
I wasn't specifically intending to make fun of the guy's appearance; he looks like a normal 20-something, doesn't look overweight, does look like he shaves regularly, does look like he gets sunlight, etc; it was just that after I tracked the guy down I was disappointed that he wasn't actually wearing a ninja mask in his picture (or whatever).
Putting on a 'better than thou' attitude can be fun and amusing at times, but it works better if you command a decent grasp on the English language.
(defun ensure-list (a) (if (listp a) a (loop for i from 0 to a collect i))) (defparameter l '(0 7 (0 3) (0 3) 7 0 7 (1 4 7) (1 7) (1 7) 1 0 7 1 1 1 1 0 7 1 1 1 1 0 6 (7 1) (7 1) (7 1) 6 0)) (defparameter g (loop for i from 0 to 9 collecting (loop for i from 1 to (length l) collecting ()))) (setf g (append (list (mapcar (lambda (sp) 's) (car g))) (cdr g))) (defun s () (setf g (append (list (loop for i from 1 to (length (car g)) collecting (if (< .1 (random 1.0)) 's ()))) (loop for i from 1 to (1- (length g)) collecting (mapcar (lambda (a b x) (if (and a (or (not (find (- (length globe) i) (ensure-list x))) (> .05 (random 1.0)))) 's (and b (not (find (- (length globe) i) (ensure-list x)))))) (nth (- i 1) g) (nth i g) l))))) (defun d (itm) (cond ((not itm) (format t ". ")) ((atom itm) (format t "$$")) ((listp itm) (d (car itm)) (d (cdr itm)) (format t "~&")))) (defun start () (dotimes (x 200) (s)(sleep 1/24)(d g)))
(start)
Assuming that they've got their 'ideal hire' right, it's almost a win-win situation for them: if you hate the ad, you probably don't like their culture; if you love it, you'll apply and you might just fit right in with these "ninjas".
It alienates some but at least not the people they're trying to hire. I'm not saying such a culture's going to be great for them, just that posting such an ad will get them exactly who they want, and some mad publicity as well.
WHY would anyone want this?
The job posting seems like something Dwight from The Office would create.
Do they want people who are going to do things in the most impractical and convoluted way possible? If so, I wouldn't recommend betting on them releasing a stable product in the near future.
Do these people use dumb interview questions like asking people to list c language trigraphs? Sure, someone that knows it might be a good programmer, but they might also write obfuscated piles of crap that cause bugs since they over complicate problems.
WSA:
push 10
push 97
push 106
push 110
push 105
push 78
push 32
push 111
push 108
dup
push 101
push 72
push 11
label 100
swap
outchar
push 1
sub
dup
jn 200
jump 100
label 200
exit
Whitespace is actually a really easy-to-code-for stack machine, you just need an assembler. Now you too can pretend to be elite.EDIT: post originally included the compiled Whitespace code, but HN does not approve of that. Fixed the line break problem, thanks to someone reminding me it needs a blank line before and after.
Indent each line 2 spaces, format it however you want, and resubmit.
This line is indented 2 spaces.
So is this one.
This is the third indented line.
After another blank line, now I'm back to normal. Hello World
It's valid PHP, and it prints "Hello World".EDIT: Realized I should add an online preview, the animation starts 6 seconds after the page loads... http://aarongough.com/hello_world.html
function floatPixel ( pixelFilled, pixelSize )
{
this.render = function ()
{
if( thisObj.pixelFilled ) thisObj.pixel.style.background = "black";
if( !thisObj.pixelFilled ) thisObj.pixel.style.background = "white";
}
this.animate = function()
{
thisObj.pixelFilled = true;
thisObj.render();
}
var thisObj = this;
this.pixelFilled = pixelFilled;
this.pixelSize = pixelSize;
this.pixel = document.createElement("div");
this.pixel.style.height = this.pixelSize + "px";
this.pixel.style.width = this.pixelSize + "px";
this.pixel.style.cssFloat = "left";
this.render();
this.timer = setTimeout( this.animate, Math.floor( Math.random() * 15000 + 6000 ));
document.getElementById("pixel_container").appendChild( this.pixel );
}
document.body.style.background = "black";
document.body.style.textAlign = "center";
var pixelContainer = document.createElement("div");
pixelContainer.id = "pixel_container";
pixelContainer.style.height = "50px";
pixelContainer.style.width = "900px";
pixelContainer.style.margin = "200px auto";
pixelContainer.style.position = "relative";
document.body.appendChild( pixelContainer );
var pixelData = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000100011111000100000001000000011111000000100010001111100011110000100000001110000010000000000000000100010001000000010000000100000001000100000010001000100010001000100010000000100100001000000000000000011111000111110001000000010000000100010000001000100010001000111100001000000010001000100000000000000001000100010000000100000001000000010001000000101010001000100010001000100000001001000000000000000000000100010001111100011111000111110001111100000011011000111110001000100011111000111000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
for( x = 0; x < pixelData.length; x++ )
{
new floatPixel( parseInt(pixelData.slice(x, x + 1)), 9 );
}Like in the 20th century, when I was born. Call me old-fashioned, but...
* not prejudiced, just not fluent in other languages.
def sort(s):
listt = list(s)
listt.sort(cmp=lambda a,b: cmp( ord(b)%len(s) , ord(a)%len(s) ))
print ''.join(listt),
sort('Oh,well')
sort('lord')
And this is the rather succinct Ruby version: def sort s
print s.split(//).sort_by.with_index{|a,i|[-(a.ord%s.length),i]}.join
end
sort 'Oh,well'
sort 'lord''' def findPossibleSolutions(querytext): for result in GoogleCodeSearch(query=querytext): yield result
def tryOutPossibleSolution(candidate): output = None with SafeSandboxedEvaluatorFactoryFactory(candidate.language).safeSandboxedEvaluator() as evaluator: output = evaluator.evaluate(candidate.code) return output
def validatePossibleSolution(candidate, validator): return validator(tryOutPossibleSolution(candidate))
def giveMeValidSolutionSourceCodes(querytext,validator): for validSolution in (candidate for candidate in findPossibleSolutions(querytext) if validatePossibleSolution(candidate,validator)): yield {'source'=validSolution.code,'extension'=validSolution.languageExtension}
if __name__ == "__main__": helloWorlds = giveMeValidSolutionSourceCodes("hello world", lambda x: x == "hello world") firstValidSource = helloWorlds() if firstValidSource: print "helloworld.%s:\n\n%s" % (firstValidSource["extension"],firstValidSource["source"]) else: print "helloworld.py:\n\nprint \"hello world\"" # default case ''
Edit: if there's a way to reproduce source code please inform.
pre def findPossibleSolutions(querytext):
for result in GoogleCodeSearch(query=querytext):
yield result
def tryOutPossibleSolution(candidate):
output = None
with SafeSandboxedEvaluatorFactoryFactory(candidate.language).safeSandboxedEvaluator() as evaluator:
output = evaluator.evaluate(candidate.code)
return output
def validatePossibleSolution(candidate, validator): return
validator(tryOutPossibleSolution(candidate))
def giveMeValidSolutionSourceCodes(querytext,validator):
for validSolution in (candidate for candidate in findPossibleSolutions(querytext) if validatePossibleSolution(candidate,validator)):
yield {'source'=validSolution.code,'extension'=validSolution.languageExtension}
if __name__ == "__main__":
helloWorlds = giveMeValidSolutionSourceCodes("hello world", lambda x: x == "hello world")
firstValidSource = helloWorlds()
if firstValidSource:
print "helloworld.%s:\n\n%s" % (firstValidSource["extension"],firstValidSource["source"])
else:
print "helloworld.py:\n\nprint \"hello world\"" # default case ''I put my money where my mouth is and sent this in (wait about 6 seconds after page-load for the animation to start): http://aarongough.com/hello_world.html
All of them,
Best,
Stephen
Wow! Constructive! I was hoping that the ad was written with humor, but apparently not!Good luck with that elitism!
include<stdio.h>
int main() {
for(unsigned long n = 154566997192872; n; n=n>>5) {
printf("%c",'`'+(n&31));
}
} $ cat /usr/share/dict/words | egrep -o "(^world$)|(^hello$)" #!/usr/bin/perl
use strict;
use warnings;
our $POP_SIZE = 100;
our @GOAL = map { ord($_) - 32 } split //, 'hello world';
our $MUTATION_RATE = 0.05;
our $GENE_LENGTH = scalar @GOAL;
use constant GENE => 0;
use constant SCORE => 1;
my @population = make_initial_population( $POP_SIZE, $GENE_LENGTH );
my $generation = 1;
while (1) {
@population = rank(@population);
print as_string( $population[0][GENE] ) . "\n";
last if $population[0][SCORE] == 0;
@population = mutate( sex(@population) );
$generation++;
}
exit;
##################################################
sub as_string {
return join( '', map { chr( $_ + 32 ) } @{ $_[0] } );
}
##################################################
sub rank {
my @population = @_;
for ( my $i = 0 ; $i < @population ; $i++ ) {
$population[$i][SCORE] = score( $population[$i][GENE] );
}
@population =
sort { $a->[SCORE] <=> $b->[SCORE] || $a->[GENE] cmp $b->[GENE] }
@population;
return @population;
}
##################################################
sub score {
my ($gene) = @_;
my $value = 0;
my $num_diff = 0;
for ( my $i = 0 ; $i < @$gene ; $i++ ) {
my $diff = abs( $gene->[$i] - $GOAL[$i] );
$value += $diff;
$num_diff++ if $diff > 0;
}
return $value * $num_diff;
}
##################################################
sub sex {
my @population = @_;
my $end = $#population / 2;
for ( my $i = 0 ; $i < $end ; $i++ ) {
my @mother = @{ $population[$i][GENE] };
my @father = @{ $population[ $i + 1 ][GENE] };
my ( $sp1, $sp2 );
while (1) {
$sp1 = int( rand($GENE_LENGTH) );
$sp2 = int( rand($GENE_LENGTH) );
last
if $sp1 < $sp2
&& $sp1 > 0
&& $sp2 < $GENE_LENGTH - 1;
}
$population[ $end + $i ][GENE] = [
@mother[ 0 .. $sp1 - 1 ],
@father[ $sp1 .. $sp2 - 1 ],
@mother[ $sp2 .. $GENE_LENGTH - 1 ]
];
$population[ $end + $i + 1 ][GENE] = [
@father[ 0 .. $sp1 - 1 ],
@mother[ $sp1 .. $sp2 - 1 ],
@father[ $sp2 .. $GENE_LENGTH - 1 ]
];
}
return @population;
}
##################################################
sub mutate {
my @population = @_;
for ( my $i = 0 ; $i < $#population ; $i++ ) {
if ( rand() > $MUTATION_RATE ) {
my $gene = $population[$i][GENE];
my $chromosone_num = rand($GENE_LENGTH);
my $chromosone = $gene->[$chromosone_num];
$chromosone += int( rand(5) + 0.5 ) - 2; # -2, -1, 0, 1, 2
$chromosone %= ( 128 - 32 );
$population[$i][GENE][$chromosone_num] = $chromosone;
}
}
return @population;
}
##################################################
sub make_initial_population {
my ( $pop_size, $gene_length ) = @_;
my @population;
foreach ( 1 .. $pop_size ) {
my @gene = map { int( rand( 128 - 32 ) ) } ( 1 .. $gene_length );
push @population, [ \@gene, 0 ];
}
return @population;
}
##################################################Second look: Awesomely original