Tuesday, January 26, 2016

The FizzBuzz

http://blog.codinghorror.com/why-cant-programmers-program/

Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".

#!/usr/bin/env ruby
(1..100).each do |i|
   if( i % 3 == 0 && i % 5 != 0 )
      p "Fizz"
   elsif( i % 5 == 0 && i % 3 != 0 )
      p "Buzz"
   elsif( i % 5 == 0 && i % 3 == 0 )
      p "FizzBuzz"
   else
      p i
   end
end 


Seems like there should be a more elegant solution to this.  But this only took about 2 minutes to do.  Arg, now I'm curious to know if this would have passed the test!  Ahh well, guess I'll just stuff this in the corner for future reference.

Monday, January 4, 2016

docker-gen

This was a neat question:

https://stackoverflow.com/questions/34594654/nginx-proxy-running-multiple-ports-tied-to-different-virtual-hosts-on-one-conta

Which got me to these two repos:

https://github.com/jwilder/nginx-proxy
https://github.com/jwilder/docker-gen

This is a neat little project.  It looks like you can embed little bits of configuration hotness into a docker container and basically treat this system like a little mini chef implementation.

That is really cool, I'm going to have to look into this more later...