Contribute to free-programming-books development by creating an account on GitHub.
Lint Roller? I Barely Know Her

ellievsbear
wallacepolsom

@theartofmadeline

★
styofa doing anything
Today's Document

No title available
TVSTRANGERTHINGS
Keni
Claire Keane
Misplaced Lens Cap

PR's Tumblrdome
No title available
ojovivo

Andulka
tumblr dot com
h
2025 on Tumblr: Trends That Defined the Year
AnasAbdin
seen from United States
seen from Türkiye
seen from United States

seen from United Kingdom
seen from Türkiye
seen from United States

seen from Germany
seen from Malaysia
seen from United States
seen from United States

seen from Netherlands
seen from Croatia
seen from United States

seen from Finland
seen from United States
seen from United States
seen from United States

seen from Mexico

seen from Indonesia
seen from Malaysia
@lrthw-studynotes
Contribute to free-programming-books development by creating an account on GitHub.
Zork
• Author: Dave Lebling and Marc Blank • Released: 1980 • Genre: Fantasy • Difficulty: Standard
Welcome to ZORK! You are about to experience a classic interactive fantasy, set in a magical universe. The ZORK trilogy takes place in the ruins of an ancient empire lying far underground. You, a dauntless treasure-hunter, are venturing into this dangerous land in search of wealth and adventure. Because each part of the ZORK saga is a completely independent story, you can explore them in any order. However, since ZORK I is the least difficult, it is usually the best place to begin.
Many strange tales have been told of the fabulous treasures, exotic creatures and diabolical puzzles in the Great Underground Empire. As an aspiring adventurer you will undoubtedly want to locate the treasures and deposit them in your trophy case. You'd better equip yourself with a source of light (for the caverns are dark) and weapons (for some of the inhabitants are unfriendly - especially the thief, a skilled pickpocket and ruthless opponent.
Download Zork for free at: http://www.infocom-if.org/downloads/downloads.html
ARGV
In your Ruby programs, you can access any command-line arguments passed by the shell with the ARGV special variable. ARGV is an Array variable which holds, as strings, each argument passed by the shell. The following program iterates over the ARGV array and prints out its contents.
#!/usr/bin/env ruby ARGV.each do |a| puts "Argument: #{a}" end
The following is an excerpt of a bash session launching this script (saved as the file test.rb) with a variety of arguments.
$ ./test.rb test1 test2 "three four" Argument: test1 Argument: test2 Argument: three four
Figure out which directories on your system Ruby will look in to find the libraries you require.
Open an irb console and type:
puts $LOAD_PATH
You'll see all the directories where ruby look to find the libraries needed.
UPDATE: also puts $: did the trick.
Can you require a script that doesn't contain a library specifically?
Yes I can :)
Difference between require and include
The include and require methods do very different things.
The require method does what include does in most other programming languages: run another file. It also tracks what you've required in the past and won't require the same file twice. To run another file without this added functionality, you can use the load method.
The include method takes all the methods from another module and includes them into the current module. This is a language-level thing as opposed to a file-level thing as with require. The include method is the primary way to "extend" classes with other modules (usually referred to as mix-ins). For example, if your class defines the method "each", you can include the mixin module Enumerable and it can act as a collection. This can be confusing as the include verb is used very differently in other languages.
OpenURI
OpenURI is an easy-to-use wrapper for net/http, net/https and net/ftp.
Example
It is possible to open http/https/ftp URL as usual like opening a file: open("http://www.ruby-lang.org/") {|f| f.each_line {|line| p line} } The opened file has several methods for meta information as follows since it is extended by OpenURI::Meta. open("http://www.ruby-lang.org/en") {|f| f.each_line {|line| p line} p f.base_uri # <URI::HTTP:0x40e6ef2 URL:http://www.ruby-lang.org/en/> p f.content_type # "text/html" p f.charset # "iso-8859-1" p f.content_encoding # [] p f.last_modified # Thu Dec 05 02:45:02 UTC 2002 } Additional header fields can be specified by an optional hash argument. open("http://www.ruby-lang.org/en/", "User-Agent" => "Ruby/#{RUBY_VERSION}", "From" => "[email protected]", "Referer" => "http://www.ruby-lang.org/") {|f| # ... } The environment variables such as http_proxy, https_proxy and ftp_proxy are in effect by default. :proxy => nil disables proxy. open("http://www.ruby-lang.org/en/raa.html", :proxy => nil) {|f| # ... } URI objects can be opened in a similar way. uri = URI.parse("http://www.ruby-lang.org/en/") uri.open {|f| # ... } URI objects can be read directly. The returned string is also extended by OpenURI::Meta. str = uri.read p str.base_uri Author:: Tanaka Akira <[email protected]>