This test was fun

in #code8 years ago (edited)

I found todays test to be much funner than all the others.

The reason being it was 90 minutes of making a demo project. Then only 30 minutes for multiple choice style questions.

I was so so close to building everything how I wanted but some last minute bugs put me over the time. So I ended up having to do a dirty patch just to get a working demo.

Screenshot from 2018-03-19 12-13-25.png

What I was originally going for based on the instructions was:

  • React mobile app front-end
  • Simple Express.js API on the back-end

I think one of my major problems was that I tried to use React router and then serve the React app through Express so that the API and front-end would be on the same port.

With less than 30 minutes left I realized that the React Router was having some compatibility issues with Express. As a work around I was thinking to serve the front-end and back-end on 2 different ports. The problem with that was it created cross-origin problems so the requests from the front-end to the back-end completely failed. Even though each piece was working stand-alone.

I ended up moving the logic in the backend, essentially just an API that serves a set of photos in order. e.g. you request /webcam1 it returns photo1, request again for photo2, then at the last photo just loop back to the first.

I think I would have had a better final product if I just used vanilla HTML/JS for the front-end instead of introducing React and a Router. I was over-shooting what I could do in 90 minutes time, so I was never able to reach what I was imagining.

The questions weren't bad either. I felt I did ok on most of them. I used Perl for question because it is good for Regex, but with that too it didn't work exactly as expected:

#! perl
$string = "0x123456789abcdefABCDEF";
if ($string =~ /^0x[0-9A-F]+$/i) {
  print "is hex between 16-64";
} else {
  print "not hex between 16-64";
}

Above is what I got working but it doens't check for length of the string. I was thinking the following should work to check length also:

if($string =~ /^0x[0-9A-F]+$/i && $string =~ m/^.{16..64}$/mg)

But once I added the second condition it started returning false even when the string was between 16-64. Does anyone good with Perl know what I did wrong here?

Edit: in retrospect just realized the backend was just going to incriminate every request. That was a bad choice as multiple users would incriminate the same counter. Doh

Coin Marketplace

STEEM 0.04
TRX 0.33
JST 0.077
BTC 62136.92
ETH 1631.41
USDT 1.00
SBD 0.40