Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000Originally published in June 2008
When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.
To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.
Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.
"For comprehension" is a another syntaxe to use map, flatMap and withFilter (or filter) methods.
yield keyword is used to aggregate values in the resulting structure.
This composition can be used on any type implementing this methods, like List, Option, Future...
| def countChange(money: Int, coins: List[Int]): Int = | |
| if (money < 0 || coins.isEmpty) | |
| 0 | |
| else if (money == 0) | |
| 1 | |
| else | |
| countChange(money - coins.head, coins) + countChange(money, coins.tail) |
| /** | |
| * D Holbrook | |
| * | |
| * Code Club: PO1 | |
| * | |
| * (*) Define a binary tree data structure and related fundamental operations. | |
| * | |
| * Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported: | |
| * | |
| * Constructors |
Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).
This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.
If you want to use or share this material, please see the license file, below.
| # Doesn't work | |
| <p> | |
| <% case @request.author_hosted %> | |
| <% when "yes" %> | |
| The school <b>has</b> hosted an author before. | |
| <% when "no" %> | |
| The school <b>has not</b> hosted an author before. | |
| <% end %> | |
| </p> |