Más contenido relacionado Similar a Communication is a Technical Skill (20) Communication is a Technical Skill31. YOUR PRODUCT IS NOT JUST YOUR CODE
DOCUMENTATION, WEBSITE,
BLOG
GITHUB
STACK OVERFLOW
SOCIAL MEDIA
CONFERENCE TALKS, MEETUPS, HACKATHONS,
38. 8 minutes on
Rack
based on a presentation by
Dan Webb (dan@danwebb.net)
@danwrong
http://slidesha.re/dan_on_rack
44. that has a call method which takes
one argument...
app.call(env)
45. and that method returns an array
with 3 elements...
[200, { 'Content-Type' => 'text/plain' }, 'Hello World!']
46. then you can connect it to any web
server that supports Rack
require 'thin'
Rack::Handler::Thin.run(app, :Port => 4000)
50. app = Proc.new do |env|
[200, { 'Content-Type' => 'text/plain' },
'Hello World!']
end
require 'rubygems'
require 'thin'
Rack::Handler::Thin.run(app, :Port => 4000)
51. class HelloWorld
def initialize(name)
@name = name
end
def call(env)
[200, { 'Content-Type' => 'text/plain' },
"Hello #{@name}!"] end
end
require 'rubygems'
require 'rack'
Rack::Handler::Mongrel.run(HelloWorld.new("Dan"),
:Port => 4000)
53. {
"SERVER_NAME"=>"localhost",
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate",
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en- GB;
rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4",
"PATH_INFO"=>"/",
"SCRIPT_NAME"=>"",
"SERVER_PROTOCOL"=>"HTTP/1.1",
"HTTP_ACCEPT_LANGUAGE"=>"en-gb,en;q=0.5",
"HTTP_HOST"=>"localhost:4000",
"REMOTE_ADDR"=>"127.0.0.1",
"HTTP_KEEP_ALIVE"=>"300",
"REQUEST_PATH"=>"/",
"SERVER_SOFTWARE"=>"thin 0.8.2 codename Double Margarita",
"HTTP_ACCEPT_CHARSET"=>"ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"HTTP_VERSION"=>"HTTP/1.1", "REQUEST_URI"=>"/",
"SERVER_PORT"=>"4000",
"QUERY_STRING"=>"",
"GATEWAY_INTERFACE"=>"CGI/1.2",
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"HTTP_CONNECTION"=>"keep-alive",
"REQUEST_METHOD"=>"GET"
}
57. Response body can be any
object that respond_to?(:each)
file = File.new('myfile.xml')
[200, { 'Content-Type' => 'application/xml' }, file]
59. class StreamingFile
def initialize(file)
@file = file
end
def length
File.size(@file)
end
def last_modified
File.mtime(@file).rfc822
end
def each
File.open(@file, "rb")
do |file|
while part = file.read(8192)
yield part
end
File.delete(@file)
end
end
68. FUNCTIONAL
ELIXIR ERLANG VM (2012)
ELM JAVASCRIPT (2012)
SCALA JAVA VM (2003)
CLOJURE JAVAVM (2007)
SWIFTiOS/Mac/Linux (2014)
HASKELL - 1990
ERLANG - 1986
ML - 1973
LISP - 1958
C - 1972
COBOL - 1959
FORTRAN - 1956
GO (2009)
JAVA - 1995
C++ - 1983OBJECTIVE C - 1984
SMALLTALK - 1972
JAVASCRIPT - 1995
RUBY - 1995
IMPERATIVEOBJECT-ORIENTED
RUST (2010)
73. PHOTO CREDITS
▸ 13) Isaiah van Hunen: Face (original 1)
https://www.flickr.com/photos/isaiah115/7301506118
https://creativecommons.org/licenses/by-sa/2.0/
▸ 14) photo by Lee Lundrigan
▸ 32) https://firebase.googleblog.com/2013/05/firebase-at-angelhack-sf-2013.html
▸ 64) Michael Basial: Light Bulb https://www.flickr.com/photos/basial/3010044632/
▸ 66) Wizard: http://mortal-affairs.wikia.com/wiki/Wizards