So you think you wanna be a web developer... Fork this, update your copy with answers. They don't need to be precise - pseudo-code is fine in most cases. Some questions don't have correct answers. Submit your answers to [email protected] FROM: [email protected] SUBJECT: [dojo4-quiz] quiz-1 BODY: https://gist.github.com/to-your-submission
==========================================================
- is this broken in html5? if so why? ==========================================================
<div id='teh_javascripts' />
The spec does not allow "self-closing" tags. In HTML5, this means ends up meaning <div id='teh_javascripts'>
leading to an unclosed tag.
The reality though is that the browsers' rendering engines are designed to assume that the developers don't know what they are doing and will try to render it anyway.
'http://domain.com:4242/foo/bar/baz.html'
GET /foo/bar/baz.html HTTP/1.1
Host: domain.com
========================================================== 3. in any language you choose, write this to run in parallel
numbers = 20, 1
results = []
numbers.each do |number|
results.push( parallelize{ number * 2 } )
end
sum = reduce( results )
teh answerz...
========================================================== 4. in any language you choose, write this to run in parallel on multiple cores
numbers = 20, 1
results = []
numbers.each do |number|
results.push( parallelize{ number * 2 } )
end
sum = reduce( results )
teh answerz...
<label for='user.email'>
<input name='user.email'>
teh answerz...
if @not_modified
render :status => status
end
In this context, it is probably undefined ;) However, the HTTP spec would expect the status to be 304 NOT MODIFIED. This tells the browser to use the cached copy.
========================================================== 7. is this javascript broken? if so, why?
var submit = document.getElementById("submit");
submit.click();
teh answerz...
<!-- A -->
<table>
<tr>
<td class='key' style='width:33%'>
{{ dynamic_content_for(:key) }}
</td>
<td class='val'>
{{ dynamic_content_for(:val) }}
</td>
</tr>
</table>
<!-- B -->
<div class='fluid grid'>
<div class='row'>
<span class='key width33'>
{{ dynamic_content_for(:key) }}
</span>
<span class='val'>
{{ dynamic_content_for(:val) }}
</span>
</div>
</div>
The table cells will expand horizontally until it can't anymore. Afterwards, the td's content would wrap. The span would either expand as far as it can or would push some content down. Keeping the size of the spans in sync is much harder.
It is perfectly fine to use table for tabular data.
# A
if var == 42
"..."
end
# B
if 42 == var
"..."
end
teh answerz...
@response =
http_request(url, :method => method, :params => params, :headers => headers)
if @response.ok?
ship_it!
else
debugger!
end
teh answerz...
# A
if foo.bar.baz
'...'
end
# B
if foo
if foo.bar
if foo.bar.baz
'...'
end
end
end
teh answerz...
========================================================== 12. is this javascript broken? if so, why?
ajax(url)({
'method' : 'POST',
'params' : params,
'headers' : headers
});
teh answerz...
'#FFE'
teh answerz...
0b101010
teh answerz...
========================================================== 15. describe an algorithm to detect the 'edges' in these pixels
0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0
teh answerz...
$color = [@X, @R, @G, @B].as_hex
teh answerz...
========================================================== 16. what are the advantages of static linking?
export HINT=$LD_RUN_PATH
teh answerz...
var uploader = new qq.FileUploader(options);
var image_ids = [];
uploader._uploadFileList = function(){
image_ids = [];
var args = Array.prototype.slice.call(arguments);
var result = qq.FileUploaderBasic.prototype._uploadFileList.apply(uploader, args);
return(result);
};
teh answerz...
jQuery('.help').find('a').attr('tabindex', '-1');
teh answerz...
~ > run_api_tests_locally
"FAIL: you must access teh API from a box on EC2 with IP 1.2.3.4!"
teh answerz...
// A
User.prototype.first_name = function(){
return this.name.split(/\s+/)[0];
};
// B
User.prototype.first_name = function(){
return User.first_name_for(this.name);
};
User.first_name_for = function(name){
return name.split(/\s+/)[0];
};
teh answerz...