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 8000
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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 8000
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
One of the many reasons I love working with Ruby is it has a rich vocabulary that allows you to accomplish your goals with a minimal amount of code. If there isn't a method that does exactly what you want, it's usually possible to build an elegant solution yourself.
Let's take the example of simulating the rolling of a die.
We can represent a die as an array of its faces.
die = [*?⚀..?⚅]
# => ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]
Пример из pepegramming канала
Есть экшен в рельсе, который создает инвойс:
def create
invoice = Invoice.new(params[:invoice])
if invoice.save
Sometimes a programming language has a "strict mode" to restrict unsafe constructs. E.g., Perl has use strict
, Javascript has "use strict"
, and Visual Basic has Option Strict
. But what about bash? Well, bash doesn't have a strict mode as such, but it does have an unofficial strict mode:
set -euo pipefail
set -e