Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MagmaConf 2013: Crazy Ruby

MagmaConf 2013: Crazy Ruby

Konstantin Haase

June 17, 2013
Tweet

More Decks by Konstantin Haase

Other Decks in Technology

Transcript

  1. Sinatra in SIX Lines How to do crazy stuff with

    ruby %w.rack  )lt  INT  TERM..map{|l|trap(l){$r.stop}rescue  require  l};puts  "==  Almost  Sinatra/No  Version  has  taken  the  stage  on  4567  for  development  with  backup  from  Webrick" $n=Module.new{extend  Rack;a,D,S,q=Builder.new,Object.method(:define_method),/@@  *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m %w[get  post  put  delete].map{|m|D.(m){|u,&b|a.map(u){run-­‐>(e){[200,{"Content-­‐Type"=>"text/html"},[a.instance_eval(&b)]]}}}} Tilt.mappings.map{|k,v|D.(k){|n,*o|$t||=(h={};File.read(caller[0][/^[^:]+/]).scan(S){|a,b|h[a]=b};h);v[0].new(*o){n=="#{n}"?n:$t[n.to_s]}.render(a,o[0].try(:[],:locals)||{})}} %w[set  enable  disable  configure  helpers  use  register].map{|m|D.(m){|*_,&b|b.try  :[]}};END{Handler.get("webrick").run(a,Port:4567){|s|$r=s}} %w[params  session].map{|m|D.(m){q.send  m}};a.use  Session::Cookie;a.use  Lock;D.(:before){|&b|a.use  Rack::Config,&b};before{|e|q=Request.new  e;q.params.dup.map{|k,v|params[k.to_sym]=v}}}
  2. “second to K&R, the most lagom technical book I’ve read.”

    Peter  Cooper  (Ruby  Inside) discount code: AUTHD 50% off ebook ($6.50) 40% OFF PRINT
  3. THanks! get a Hug And a Picture Will  send  out

     Travis  Pro  invites  by  the  end  of  the  week. Sean  Allen,  Rafael  Magana,  @salemine,  Patrick  Huesler,  Julian  Cheal,  Dylan   Fogarty-­‐MacDonald,  chris,  Piotr  Sarnacki,  Lincoln  Stoll,  David  Goodlad,   Pavel  Argentov,  Sean,  Esteban  Cortes,  Juan  Carlos  Rojas,  Cornelia  Rehbein,   Fernando  Perales,  Victor  Velazquez,  Eduardo  Figarola  Mota,  David  Padilla,  ChrisNan   Romero,  IGNACIO  GALINDO,  Tania  Escudero,  Daniel  Grünthal,  Vlad  Gorodetsky,   Ben  Schwarz,  Ismael  Marin,  CARLOS  ARAOZ  GRAGEDA,  Sean  Allen,  Pat  Allan,  César   Salazar,  Travis  CI
  4. Until programmers stop acting like obfuscation is morally hazardous, they’re

    not artists, just kids who don’t want their food to touch. why  the  lucky  s(ff
  5. !?!

  6. v=0000;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP 4ZojjV)O>qIH1/n[|2yE[>:ieC "%.#% :::##" 97N-A&Kj_K_><wS5rtWk@*a+Y5 yH?b[F^e7C/56j|pmRe+:)B "##% ::##########" O98(Zh)'Iof*nm.,$C5Nyt=

    PPu01Avw^<IiQ=5$'D-y? "##: ###############" g6`YT+qLw9k^ch|K'),tc 6ygIL8xI#LNz3v}T=4W "# #. .####:#######" lL27FZ0ij)7TQCI)P7u }RT5-iJbbG5P-DHB<. " ##### # :############" R,YvZ_rnv6ky-G+4U' $*are@b4U351Q-ug5 " #######################" 00x8RR%`Om7VDp4M5 PFixrPvl&<p[]1IJ " ############:#### %#####" EGgDt8Lm#;bc4zS^ y]0`_PstfUxOC(q " .#############:##% .## ." /,}.YOIFj(k&q_V zcaAi?]^lCVYp!; " %% .################. #. " ;s="v=%04o;ev"% (;v=(v-($*+[45, ":####: :##############% : " ])[n=0].to_i;)% 360)+"al$s=%q#{ "%######. ######### " ;;"%c"%126+$s<< 126}";d.gsub!(/ "##########. #######% " |\s|".*"/,"");; require"zlib"|| "########### :######. " ;d=d.unpack"C*" d.map{|c|n=(n|| ":#########: .######: . " )*90+(c-2)%91}; e=["%x"%n].pack " :#######% :###### #: " &&"H*";e=Zlib:: Inflate.inflate( " ######% .####% :: " &&e).unpack("b*" )[0];22.times{|y| " ####% %### " ;w=(Math.sqrt(1-( (y*2.0-21)/22)**(; " .###: .#% " ;2))*23).floor;(w* 2-1).times{|x|u=(e+ " %## " )[y*z=360,z]*2;u=u[ 90*x/w+v+90,90/w];s[( " #. " ;y*80)+120-w+x]=(""<< 32<<".:%#")[4*u.count(( " . " ;"0"))/u.size]}};;puts\ s+";_ The Qlobe#{" "*18+ ( "# :#######" ;"Copyright(C).Yusuke End\ oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010
  7. v=0473;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP 4ZojjV)O>qIH1/n[|2yE[>:ieC "###%.#% ::" 97N-A&Kj_K_><wS5rtWk@*a+Y5 yH?b[F^e7C/56j|pmRe+:)B "#####%##. .:#####" O98(Zh)'Iof*nm.,$C5Nyt=

    PPu01Avw^<IiQ=5$'D-y? "#####%###: ########" g6`YT+qLw9k^ch|K'),tc 6ygIL8xI#LNz3v}T=4W "%######## #. .####" lL27FZ0ij)7TQCI)P7u }RT5-iJbbG5P-DHB<. " :####### ##### # :###" R,YvZ_rnv6ky-G+4U' $*are@b4U351Q-ug5 " :### : :#############" 00x8RR%`Om7VDp4M5 PFixrPvl&<p[]1IJ " %#... ############:##" EGgDt8Lm#;bc4zS^ y]0`_PstfUxOC(q " .###: %############:##" /,}.YOIFj(k&q_V zcaAi?]^lCVYp!; " :. %% .################" ;s="v=%04o;ev"% (;v=(v-($*+[45, " :####: :##############%" ])[n=0].to_i;)% 360)+"al$s=%q#{ " %######. ######### " ;;"%c"%126+$s<< 126}";d.gsub!(/ " ##########. #######% " |\s|".*"/,"");; require"zlib"|| " ########### :######. " ;d=d.unpack"C*" d.map{|c|n=(n|| " :#########: .######: ." )*90+(c-2)%91}; e=["%x"%n].pack " ########. ######%:#" &&"H*";e=Zlib:: Inflate.inflate( " ######% .####% ::" &&e).unpack("b*" )[0];22.times{|y| " :####. .###: " ;w=(Math.sqrt(1-( (y*2.0-21)/22)**(; " .###: .#% " ;2))*23).floor;(w* 2-1).times{|x|u=(e+ " %## " )[y*z=360,z]*2;u=u[ 90*x/w+v+90,90/w];s[( " #. " ;y*80)+120-w+x]=(""<< 32<<".:%#")[4*u.count(( " : " ;"0"))/u.size]}};;puts\ s+";_ The Qlobe#{" "*18+ ( "#### :####" ;"Copyright(C).Yusuke End\ oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010
  8. v=0416;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP 4ZojjV)O>qIH1/n[|2yE[>:ieC ".#####%.#% " 97N-A&Kj_K_><wS5rtWk@*a+Y5 yH?b[F^e7C/56j|pmRe+:)B " .#####%##% :"

    O98(Zh)'Iof*nm.,$C5Nyt= PPu01Avw^<IiQ=5$'D-y? " #####%###: #" g6`YT+qLw9k^ch|K'),tc 6ygIL8xI#LNz3v}T=4W " %######## #." lL27FZ0ij)7TQCI)P7u }RT5-iJbbG5P-DHB<. " :####### ###" R,YvZ_rnv6ky-G+4U' $*are@b4U351Q-ug5 " ###: : ####" 00x8RR%`Om7VDp4M5 PFixrPvl&<p[]1IJ " %#... #####" EGgDt8Lm#;bc4zS^ y]0`_PstfUxOC(q " %### .#####" /,}.YOIFj(k&q_V zcaAi?]^lCVYp!; " :. %% .#####" ;s="v=%04o;ev"% (;v=(v-($*+[45, " :####: :####" ])[n=0].to_i;)% 360)+"al$s=%q#{ " %######. " ;;"%c"%126+$s<< 126}";d.gsub!(/ " ##########. " |\s|".*"/,"");; require"zlib"|| " ########### " ;d=d.unpack"C*" d.map{|c|n=(n|| " :#########: " )*90+(c-2)%91}; e=["%x"%n].pack " :#######% " &&"H*";e=Zlib:: Inflate.inflate( " ######% " &&e).unpack("b*" )[0];22.times{|y| " ####% " ;w=(Math.sqrt(1-( (y*2.0-21)/22)**(; " .###: " ;2))*23).floor;(w* 2-1).times{|x|u=(e+ " %## " )[y*z=360,z]*2;u=u[ 90*x/w+v+90,90/w];s[( " #. " ;y*80)+120-w+x]=(""<< 32<<".:%#")[4*u.count(( " . " ;"0"))/u.size]}};;puts\ s+";_ The Qlobe#{" "*18+ ( " .##### :#" ;"Copyright(C).Yusuke End\ oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010
  9. v=0341;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP 4ZojjV)O>qIH1/n[|2yE[>:ieC "#% .#####%." 97N-A&Kj_K_><wS5rtWk@*a+Y5 yH?b[F^e7C/56j|pmRe+:)B " : %#####%##.

    " O98(Zh)'Iof*nm.,$C5Nyt= PPu01Avw^<IiQ=5$'D-y? " #####%###: " g6`YT+qLw9k^ch|K'),tc 6ygIL8xI#LNz3v}T=4W " %######## " lL27FZ0ij)7TQCI)P7u }RT5-iJbbG5P-DHB<. " :####### " R,YvZ_rnv6ky-G+4U' $*are@b4U351Q-ug5 " :### : " 00x8RR%`Om7VDp4M5 PFixrPvl&<p[]1IJ " %#... " EGgDt8Lm#;bc4zS^ y]0`_PstfUxOC(q " .###: " /,}.YOIFj(k&q_V zcaAi?]^lCVYp!; " :. %% " ;s="v=%04o;ev"% (;v=(v-($*+[45, " :####: " ])[n=0].to_i;)% 360)+"al$s=%q#{ " %######. " ;;"%c"%126+$s<< 126}";d.gsub!(/ " ##########" |\s|".*"/,"");; require"zlib"|| "% ##########" ;d=d.unpack"C*" d.map{|c|n=(n|| " :#########" )*90+(c-2)%91}; e=["%x"%n].pack " ########" &&"H*";e=Zlib:: Inflate.inflate( "#. ######%" &&e).unpack("b*" )[0];22.times{|y| "## :####. " ;w=(Math.sqrt(1-( (y*2.0-21)/22)**(; "#. .###: " ;2))*23).floor;(w* 2-1).times{|x|u=(e+ "% . %## " )[y*z=360,z]*2;u=u[ 90*x/w+v+90,90/w];s[( " . #. " ;y*80)+120-w+x]=(""<< 32<<".:%#")[4*u.count(( " : " ;"0"))/u.size]}};;puts\ s+";_ The Qlobe#{" "*18+ ( "#. .##### " ;"Copyright(C).Yusuke End\ oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010
  10. v=0264;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP 4ZojjV)O>qIH1/n[|2yE[>:ieC "####% .####" 97N-A&Kj_K_><wS5rtWk@*a+Y5 yH?b[F^e7C/56j|pmRe+:)B "##### : .#####"

    O98(Zh)'Iof*nm.,$C5Nyt= PPu01Avw^<IiQ=5$'D-y? "######. #####%" g6`YT+qLw9k^ch|K'),tc 6ygIL8xI#LNz3v}T=4W "####: . %######" lL27FZ0ij)7TQCI)P7u }RT5-iJbbG5P-DHB<. "#### . :######" R,YvZ_rnv6ky-G+4U' $*are@b4U351Q-ug5 "####% ###: " 00x8RR%`Om7VDp4M5 PFixrPvl&<p[]1IJ "### %#..." EGgDt8Lm#;bc4zS^ y]0`_PstfUxOC(q "## .. %###" /,}.YOIFj(k&q_V zcaAi?]^lCVYp!; ":#. . :" ;s="v=%04o;ev"% (;v=(v-($*+[45, ": : : " ])[n=0].to_i;)% 360)+"al$s=%q#{ "% %#: " ;;"%c"%126+$s<< 126}";d.gsub!(/ "#::#.: %#% " |\s|".*"/,"");; require"zlib"|| " : :#% " ;d=d.unpack"C*" d.map{|c|n=(n|| " :% : " )*90+(c-2)%91}; e=["%x"%n].pack " %###%% " &&"H*";e=Zlib:: Inflate.inflate( " ########. " &&e).unpack("b*" )[0];22.times{|y| " ########. " ;w=(Math.sqrt(1-( (y*2.0-21)/22)**(; " ##:%###. " ;2))*23).floor;(w* 2-1).times{|x|u=(e+ " %% . " )[y*z=360,z]*2;u=u[ 90*x/w+v+90,90/w];s[( " . " ;y*80)+120-w+x]=(""<< 32<<".:%#")[4*u.count(( " " ;"0"))/u.size]}};;puts\ s+";_ The Qlobe#{" "*18+ ( "####. .###" ;"Copyright(C).Yusuke End\ oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010
  11. v=0207;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP 4ZojjV)O>qIH1/n[|2yE[>:ieC "#######% .#" 97N-A&Kj_K_><wS5rtWk@*a+Y5 yH?b[F^e7C/56j|pmRe+:)B "##########: : "

    O98(Zh)'Iof*nm.,$C5Nyt= PPu01Avw^<IiQ=5$'D-y? "#############. " g6`YT+qLw9k^ch|K'),tc 6ygIL8xI#LNz3v}T=4W "############: . " lL27FZ0ij)7TQCI)P7u }RT5-iJbbG5P-DHB<. "############# . " R,YvZ_rnv6ky-G+4U' $*are@b4U351Q-ug5 "############## " 00x8RR%`Om7VDp4M5 PFixrPvl&<p[]1IJ "# %######### " EGgDt8Lm#;bc4zS^ y]0`_PstfUxOC(q " %#: %##: : " /,}.YOIFj(k&q_V zcaAi?]^lCVYp!; " #. .:#. . " ;s="v=%04o;ev"% (;v=(v-($*+[45, " : : : : " ])[n=0].to_i;)% 360)+"al$s=%q#{ " :% %#: " ;;"%c"%126+$s<< 126}";d.gsub!(/ " #::#.: %#% " |\s|".*"/,"");; require"zlib"|| " : :#% " ;d=d.unpack"C*" d.map{|c|n=(n|| " :% : " )*90+(c-2)%91}; e=["%x"%n].pack " .###%# " &&"H*";e=Zlib:: Inflate.inflate( " ########. " &&e).unpack("b*" )[0];22.times{|y| " :######## " ;w=(Math.sqrt(1-( (y*2.0-21)/22)**(; " ##:%###. " ;2))*23).floor;(w* 2-1).times{|x|u=(e+ " %% . " )[y*z=360,z]*2;u=u[ 90*x/w+v+90,90/w];s[( " . " ;y*80)+120-w+x]=(""<< 32<<".:%#")[4*u.count(( " " ;"0"))/u.size]}};;puts\ s+";_ The Qlobe#{" "*18+ ( "#######. ." ;"Copyright(C).Yusuke End\ oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010
  12. v=0132;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP 4ZojjV)O>qIH1/n[|2yE[>:ieC ":::#######%" 97N-A&Kj_K_><wS5rtWk@*a+Y5 yH?b[F^e7C/56j|pmRe+:)B "################ : " O98(Zh)'Iof*nm.,$C5Nyt=

    PPu01Avw^<IiQ=5$'D-y? "####################. " g6`YT+qLw9k^ch|K'),tc 6ygIL8xI#LNz3v}T=4W " .####:############: . " lL27FZ0ij)7TQCI)P7u }RT5-iJbbG5P-DHB<. "# # :################# . " R,YvZ_rnv6ky-G+4U' $*are@b4U351Q-ug5 "#######################% " 00x8RR%`Om7VDp4M5 PFixrPvl&<p[]1IJ "######:#### %######### " EGgDt8Lm#;bc4zS^ y]0`_PstfUxOC(q "#######:##% .## .### .. " /,}.YOIFj(k&q_V zcaAi?]^lCVYp!; "##########. #. .:#. . " ;s="v=%04o;ev"% (;v=(v-($*+[45, "#########% : : : : " ])[n=0].to_i;)% 360)+"al$s=%q#{ "######### :% %#: " ;;"%c"%126+$s<< 126}";d.gsub!(/ "#######% #::#.: %#% " |\s|".*"/,"");; require"zlib"|| ":######. : :#% " ;d=d.unpack"C*" d.map{|c|n=(n|| ".######: . :% : " )*90+(c-2)%91}; e=["%x"%n].pack ":###### #: %###%% " &&"H*";e=Zlib:: Inflate.inflate( ".####% :: ########. " &&e).unpack("b*" )[0];22.times{|y| " %### ########. " ;w=(Math.sqrt(1-( (y*2.0-21)/22)**(; " .#% ##:%###. " ;2))*23).floor;(w* 2-1).times{|x|u=(e+ " %% . " )[y*z=360,z]*2;u=u[ 90*x/w+v+90,90/w];s[( " . " ;y*80)+120-w+x]=(""<< 32<<".:%#")[4*u.count(( " " ;"0"))/u.size]}};;puts\ s+";_ The Qlobe#{" "*18+ ( "##########." ;"Copyright(C).Yusuke End\ oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010
  13. v=0055;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP 4ZojjV)O>qIH1/n[|2yE[>:ieC "% :::#####" 97N-A&Kj_K_><wS5rtWk@*a+Y5 yH?b[F^e7C/56j|pmRe+:)B " .:################" O98(Zh)'Iof*nm.,$C5Nyt=

    PPu01Avw^<IiQ=5$'D-y? " ######################" g6`YT+qLw9k^ch|K'),tc 6ygIL8xI#LNz3v}T=4W " #. .####:############: " lL27FZ0ij)7TQCI)P7u }RT5-iJbbG5P-DHB<. " ##### # :################# . " R,YvZ_rnv6ky-G+4U' $*are@b4U351Q-ug5 " :############################ " 00x8RR%`Om7VDp4M5 PFixrPvl&<p[]1IJ " ############:#### %######### " EGgDt8Lm#;bc4zS^ y]0`_PstfUxOC(q " %############:### %#: %##: : " /,}.YOIFj(k&q_V zcaAi?]^lCVYp!; " .################. #. .:#. . " ;s="v=%04o;ev"% (;v=(v-($*+[45, " :##############% : : : : " ])[n=0].to_i;)% 360)+"al$s=%q#{ " ######### :% %#: " ;;"%c"%126+$s<< 126}";d.gsub!(/ " #######% #::#.: %#" |\s|".*"/,"");; require"zlib"|| " :######. : :" ;d=d.unpack"C*" d.map{|c|n=(n|| " .######: . :% " )*90+(c-2)%91}; e=["%x"%n].pack " ######%:# .###%" &&"H*";e=Zlib:: Inflate.inflate( " .####% :: ######" &&e).unpack("b*" )[0];22.times{|y| " .###: :#####" ;w=(Math.sqrt(1-( (y*2.0-21)/22)**(; " .#% ##:%#" ;2))*23).floor;(w* 2-1).times{|x|u=(e+ " " )[y*z=360,z]*2;u=u[ 90*x/w+v+90,90/w];s[( " " ;y*80)+120-w+x]=(""<< 32<<".:%#")[4*u.count(( " " ;"0"))/u.size]}};;puts\ s+";_ The Qlobe#{" "*18+ ( ":##########" ;"Copyright(C).Yusuke End\ oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010
  14. v=0000;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP 4ZojjV)O>qIH1/n[|2yE[>:ieC "%.#% :::##" 97N-A&Kj_K_><wS5rtWk@*a+Y5 yH?b[F^e7C/56j|pmRe+:)B "##% ::##########" O98(Zh)'Iof*nm.,$C5Nyt=

    PPu01Avw^<IiQ=5$'D-y? "##: ###############" g6`YT+qLw9k^ch|K'),tc 6ygIL8xI#LNz3v}T=4W "# #. .####:#######" lL27FZ0ij)7TQCI)P7u }RT5-iJbbG5P-DHB<. " ##### # :############" R,YvZ_rnv6ky-G+4U' $*are@b4U351Q-ug5 " #######################" 00x8RR%`Om7VDp4M5 PFixrPvl&<p[]1IJ " ############:#### %#####" EGgDt8Lm#;bc4zS^ y]0`_PstfUxOC(q " .#############:##% .## ." /,}.YOIFj(k&q_V zcaAi?]^lCVYp!; " %% .################. #. " ;s="v=%04o;ev"% (;v=(v-($*+[45, ":####: :##############% : " ])[n=0].to_i;)% 360)+"al$s=%q#{ "%######. ######### " ;;"%c"%126+$s<< 126}";d.gsub!(/ "##########. #######% " |\s|".*"/,"");; require"zlib"|| "########### :######. " ;d=d.unpack"C*" d.map{|c|n=(n|| ":#########: .######: . " )*90+(c-2)%91}; e=["%x"%n].pack " :#######% :###### #: " &&"H*";e=Zlib:: Inflate.inflate( " ######% .####% :: " &&e).unpack("b*" )[0];22.times{|y| " ####% %### " ;w=(Math.sqrt(1-( (y*2.0-21)/22)**(; " .###: .#% " ;2))*23).floor;(w* 2-1).times{|x|u=(e+ " %## " )[y*z=360,z]*2;u=u[ 90*x/w+v+90,90/w];s[( " #. " ;y*80)+120-w+x]=(""<< 32<<".:%#")[4*u.count(( " . " ;"0"))/u.size]}};;puts\ s+";_ The Qlobe#{" "*18+ ( "# :#######" ;"Copyright(C).Yusuke End\ oh, 2010")}";exit~;_ The Qlobe Copyright(C).Yusuke Endoh, 2010
  15. 3

  16. “Nobody knows them. Nobody uses them. Let's just get rid

    of flip-flops, shall we?” Magnus  Holm
  17. %w.rack  )lt  INT  TERM..map{|l|trap(l){$r.stop}rescue  require  l};puts  "==  Almost  Sinatra/No  Version

     has  taken  the  stage  on  4567  for  development  with  backup  from  Webrick" $n=Module.new{extend  Rack;a,D,S,q=Builder.new,Object.method(:define_method),/@@  *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m %w[get  post  put  delete].map{|m|D.(m){|u,&b|a.map(u){run-­‐>(e){[200,{"Content-­‐Type"=>"text/html"},[a.instance_eval(&b)]]}}}} Tilt.mappings.map{|k,v|D.(k){|n,*o|$t||=(h={};File.read(caller[0][/^[^:]+/]).scan(S){|a,b|h[a]=b};h);v[0].new(*o){n=="#{n}"?n:$t[n.to_s]}.render(a,o[0].try(:[],:locals)||{})}} %w[set  enable  disable  configure  helpers  use  register].map{|m|D.(m){|*_,&b|b.try  :[]}};END{Handler.get("webrick").run(a,Port:4567){|s|$r=s}} %w[params  session].map{|m|D.(m){q.send  m}};a.use  Session::Cookie;a.use  Lock;D.(:before){|&b|a.use  Rack::Config,&b};before{|e|q=Request.new  e;q.params.dup.map{|k,v|params[k.to_sym]=v}}} the code
  18. %w.rack  )lt  backports  INT  TERM..map{|l|trap(l){$r.stop}rescue  require  l} $n=Sinatra=Module.new{extend  Rack;a,D,S,$p,q,Applica)on=Builder.new,Object.method(:define_method),/@@  *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m,4567,a

    %w[get  post  put  delete].map{|m|D.(m){|u,&b|a.map(u){run-­‐>(e){[200,{"Content-­‐Type"=>"text/html"},[a.instance_eval(&b)]]}}}} Tilt.mappings.map{|k,v|D.(k){|n,*o|$t||=(h={};File.read(caller[0][/^[^:]+/]).scan(S){|a,b|h[a]=b};h);v[0].new(*o){n.to_s==n  ?n:$t[n.to_s]}.render(a,o[0].try(:[],:locals)||{})}} %w[set  enable  disable  configure  helpers  use  register].map{|m|D.(m){|*_,&b|b.try  :[]}};END{Handler.get("webrick").run(a,Port:$p){|s|$r=s}} %w[params  session].map{|m|D.(m){q.send  m}};a.use  Session::Cookie;a.use  Lock D.(:before){|&b|a.use  Rack::Config,&b};before{|e|q=Request.new  e;q.params.dup.map{|k,v|params[k.to_sym]=v}}} puts  "==  almost  #$n/No  Version  has  taken  the  stage  on  #$p  for  development  with  backup  from  Webrick" the code
  19. %w.rack  )lt  backports  INT  TERM..map{|l|trap(l){$r.stop}rescue  require  l} $n=Sinatra=Module.new{ extend  Rack;

    a,D,S,$p,q,Applica)on =Builder.new, Object.method(:define_method),/@@  *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m,4567,a %w[ get  post  put  delete].map{|m|D.(m){|u,&b| a.map(u){run-­‐>(e){ [200,{"Content-­‐Type"=>"text/html"}, [a.instance_eval(&b)]]}}}} Tilt.mappings.map{|k,v|D.(k){|n,*o|$t||=(h={};File.read(caller[0][/^[^:]+/]).scan(S){|a,b|h[a]=b};h);v[0].new(*o){n.to_s==n  ?n:$t[n.to_s]}.render(a,o[0].try(:[],:locals)||{})}} %w[set  enable  disable  configure  helpers  use  register].map{|m|D.(m){|*_,&b|b.try  :[]}};END{Handler.get("webrick").run(a,Port:$p){|s|$r=s}} %w[params  session].map{|m|D.(m){q.send  m}}; a.use  Session::Cookie;a.use  Lock D.(:before){|&b|a.use  Rack::Config,&b};before{|e|q=Request.new  e;q.params.dup.map{|k,v|params[k.to_sym]=v}}} puts  "==  almost  #$n/No  Version  has  taken  the  stage  on  #$p  for  development  with  backup  from  Webrick"
  20. %w.rack  )lt  backports  INT  TERM..map{|l|trap(l){$r.stop}rescue  require  l} $n=Sinatra=Module.new{extend  Rack;a, D,S,$p,q,Applica)on

    =Builder.new, Object.method(:define_method) ,/@@  *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m,4567,a %w [get  post  put  delete].map{|m| D.(m){|u,&b|a.map(u){run-­‐>(e){[200,{"Content-­‐Type"=>"text/html"},[a.instance_eval(&b)]]}}}} Tilt.mappings.map{|k,v| D.(k){|n,*o| $t||=(h={};File.read(caller[0][/^[^:]+/]).scan(S){|a,b|h[a]=b};h);v[0].new(*o){n.to_s==n  ?n:$t[n.to_s]}.render(a,o[0].try(:[],:locals)||{})}} %w[ set  enable  disable  configure  helpers  use  register]. map{|m| D.(m){|*_,&b|b.try  :[]}};END{Handler.get("webrick").run(a,Port:$p){|s|$r=s}} %w[ params  session].map{|m| D.(m){q.send  m}};a.use  Session::Cookie;a.use  Lock D.(:before){|&b|a.use  Rack::Config,&b}; before{|e|q=Request.new  e;q.params.dup.map{|k,v|params[k.to_sym]=v}}} puts  "==  almost  #$n/No  Version  has  taken  the  stage  on  #$p  for  development  with  backup  from  Webrick"
  21. %w.rack  )lt  backports  INT  TERM..map{|l|trap(l){$r.stop}rescue  require  l} $n=Sinatra=Module.new{extend  Rack;a,D, S,$p,q,Applica)on

    =Builder.new,Object.method(:define_method), /@@  *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m,4567,a %w[get  post  put  delete].map{|m|D.(m){|u,&b|a.map(u){run-­‐>(e){[200,{"Content-­‐Type"=>"text/html"},[a.instance_eval(&b)]]}}}} Tilt.mappings.map{|k,v|D.(k){|n,*o| $t||=(h={};File.read(caller[0][/^[^:]+/]) .scan(S){|a,b|h[a]=b};h); v[0].new(*o){n.to_s==n  ?n:$t[n.to_s]}. render(a,o[0].try(:[],:locals)||{})}} %w[set  enable  disable  configure  helpers  use  register].map{|m|D.(m){|*_,&b|b.try  :[]}};END{Handler.get("webrick").run(a,Port:$p){|s|$r=s}} %w[params  session].map{|m|D.(m){q.send  m}};a.use  Session::Cookie;a.use  Lock D.(:before){|&b|a.use  Rack::Config,&b};before{|e|q=Request.new  e;q.params.dup.map{|k,v|params[k.to_sym]=v}}} puts  "==  almost  #$n/No  Version  has  taken  the  stage  on  #$p  for  development  with  backup  from  Webrick"
  22. %w.rack  )lt  backports  INT  TERM..map{|l|trap(l){$r.stop}rescue  require  l} $n=Sinatra=Module.new {extend  Rack;

    a,D,S, $p,q,Applica)on =Builder.new, Object.method(:define_method),/@@  *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m, 4567,a %w[get  post  put  delete].map{|m|D.(m){|u,&b|a.map(u){run-­‐>(e){[200,{"Content-­‐Type"=>"text/html"},[a.instance_eval(&b)]]}}}} Tilt.mappings.map{|k,v|D.(k){|n,*o|$t||=(h={};File.read(caller[0][/^[^:]+/]).scan(S){|a,b|h[a]=b};h);v[0]. new(*o){n.to_s==n  ?n:$t[n.to_s]}.render(a,o[0].try(:[],:locals)||{})}} %w[set  enable  disable  configure  helpers  use  register].map{|m|D.(m){|*_,&b|b.try  :[]}}; END{Handler.get("webrick"). run(a,Port:$p){|s|$r=s}} %w[params  session].map{|m|D.(m){q.send  m}};a.use  Session::Cookie;a.use  Lock D.(:before){|&b|a.use  Rack::Config,&b};before{|e|q=Request.new  e;q.params.dup.map{|k,v|params[k.to_sym]=v}}} puts  "==  almost  #$n/No  Version  has  taken  the  stage  on #$p  for  development  with  backup  from  Webrick"
  23. “If your app does not run with Almost Sinatra, please

    open a Sinatra issue.” Konstan(n  Haase
  24. “don't include tests. tests just bloat the code base. just

    commit, the users will complain if you break anything.” Konstan(n  Haase
  25. Almost Rack Proof  that  Rack  is  simpler  than  Sinatra. Lines

     must  be  the  same  length,  no  more  than  120   characters  per  line.  No  more  than  three  lines  of  code.
  26. Almost Rack Protection Protects  you  against  most  opportunisNc  a]acks. Goes

     well  with  almost-­‐sinatra,  almost-­‐rack  or  Ruby  on   Rails.
  27. SQL injection NoSQL injection Cross Site Scripting Broken Authentication /

    Session Management Insecure Direct Object References Login spoofing Cross Site Request Forgery Security Misconfiguration Insecure Cryptographic Storage Failure to Restrict URL Access Race condition (except in your Rack handler) Insufficient Transport Layer Protection Unvalidated Redirects and Forwards Windows Metafile vulnerability Password cracking Malicious File Execution Reflection attack Mass-Assignment Bugs CRIME Arbitrary code execution Buffer overflow Metasploit Data breach Frame injection Y2K bug Timing Attacks Remote file inclusion Some DoS attacks Off-by-one error Shoulder surfing Most other CVEs