RingoJS #cgnjs  talk by  Oleg Podsechin 12.10.2010
 
Install & Run apt-get install default-jdk default-jre git-core ant git clone git://github.com/ringo/ringojs.git ant jar bin/ringo
Hello World >> 'Hello World' Hello World
Hello World, Take Two new   ( require ( 'ringo/httpserver' ) . Server )({   app :   function ()   {      return   { status :   200 ,               headers :   {} ,               body :   [ 'Hello World' ]} ;    } }) . start () ;
RingoJS overview started by  @hannesw  ( hns.github.com ) uses Mozilla  Rhino runs on the JVM successor to Helma, HelmaNG been in development for 10+ years conforms to  CommonJS
CommonJS support Modules/1.0, Modules/1.1 JSGI Binary Filesystem System Unit Testing other (mostly partial) implementations include: Akshell, CouchDB, Flusspferd, Narwhal, Persevere, RequireJS, Smart, SproutCore, node.js, v8cgi  etc .
RingoJS features #1 REPL hot reloading of modules profiler debugger ringo-admin tool runs anywhere, including AppEngine client side CommonJS modules via ringo-modulr JMX
RingoJS features #2 JavaScript 1.8 Java library wrapping runs sync and async code continuations introspection (via Rhino) middleware templating utils persistence abstraction layer
jsonp-proxy.js #1 // thanks to  @jasondavies var   { encode }   =  require ( 'ringo/base64' ) ,      { get }   =  require ( 'ringo/httpclient' ) ,      { Request }   =  require ( 'ringo/webapp/request' ) ,      { ByteString }   =  require ( 'binary' ) ; exports. app   =   function ( env )   {      var  req  =   new  Request ( env ) ;      var  url  =  req. params . url ,  raw  =  get ( url ) ;      return   {         status :   200 ,         headers :   { 'Content-Type' :   'text/javascript' } ,         body :   [ req. params . callback   +               '("data:"+decodeURIComponent("'   +              encodeURIComponent ( raw. type )   +               '")+";base64,' ,            encode ( new  ByteString ( raw. content )) ,               '")' ]      } ; }
jsonp-proxy.js #2 Usage: $. get ( 'http://seivadnosaj-js.appspot.com/proxy' ,   {   url :   'http://www.jasondavies.com/media/img/jason.jpg' } ,   function ( data )   {    var  img  =   new  Image () ;   img.onload  =   function ()   {      var  w  =  img. width ,  h  =  img. height ;     $ ( '#canvas' ) . attr ( 'width' ,  w ) . attr ( 'height' ,  h ) ;     context. width   =  w ;  context. height   =  h ;     context. drawImage ( img ,   0 ,   0 ,  w ,  h ) ;    } ;   img. src   =  data ; } ,   'jsonp' ) ; Try it at:   http://seivadnosaj-js.appspot.com/
Multithreaded JS (sort of) // run &quot;test&quot; in &quot;threads&quot; parallel threads a total of &quot;count&quot; times function  parallel ( test ,  count ,  threads )   {    var  pool  =   new  java. util . concurrent . Executors . newFixedThreadPool ( threads ) ;    function  runnable ( f )   {      return   new  java. lang . Runnable ({  run :   function ()   {        try   {  f () ;   }   catch ( e )   {   }      }}) ;    }    for ( var  i  =   0 ;  i  <  count ;  i  ++ )     pool. execute ( runnable ( test )) ; }
Debugger
Ride - web IDE
RingoJS libraries search GitHub for  ringo- ringo-admin install user/repo
RingoJS performance
RingoJS community active & friendly #ringojs on Freenode IRC #ringojs  &  @ringojs  on Twitter http://github.com/ringo
Questions?  Comments? @olegpodsechin

RingoJS

  • 1.
    RingoJS #cgnjs talk by  Oleg Podsechin 12.10.2010
  • 2.
  • 3.
    Install & Runapt-get install default-jdk default-jre git-core ant git clone git://github.com/ringo/ringojs.git ant jar bin/ringo
  • 4.
    Hello World >>'Hello World' Hello World
  • 5.
    Hello World, TakeTwo new   ( require ( 'ringo/httpserver' ) . Server )({   app :   function ()   {      return   { status :   200 ,               headers :   {} ,               body :   [ 'Hello World' ]} ;    } }) . start () ;
  • 6.
    RingoJS overview startedby @hannesw  ( hns.github.com ) uses Mozilla  Rhino runs on the JVM successor to Helma, HelmaNG been in development for 10+ years conforms to CommonJS
  • 7.
    CommonJS support Modules/1.0,Modules/1.1 JSGI Binary Filesystem System Unit Testing other (mostly partial) implementations include: Akshell, CouchDB, Flusspferd, Narwhal, Persevere, RequireJS, Smart, SproutCore, node.js, v8cgi etc .
  • 8.
    RingoJS features #1REPL hot reloading of modules profiler debugger ringo-admin tool runs anywhere, including AppEngine client side CommonJS modules via ringo-modulr JMX
  • 9.
    RingoJS features #2JavaScript 1.8 Java library wrapping runs sync and async code continuations introspection (via Rhino) middleware templating utils persistence abstraction layer
  • 10.
    jsonp-proxy.js #1 //thanks to @jasondavies var   { encode }   =  require ( 'ringo/base64' ) ,      { get }   =  require ( 'ringo/httpclient' ) ,      { Request }   =  require ( 'ringo/webapp/request' ) ,      { ByteString }   =  require ( 'binary' ) ; exports. app   =   function ( env )   {      var  req  =   new  Request ( env ) ;      var  url  =  req. params . url ,  raw  =  get ( url ) ;      return   {         status :   200 ,         headers :   { 'Content-Type' :   'text/javascript' } ,         body :   [ req. params . callback   +               '(&quot;data:&quot;+decodeURIComponent(&quot;'   +              encodeURIComponent ( raw. type )   +               '&quot;)+&quot;;base64,' ,            encode ( new  ByteString ( raw. content )) ,               '&quot;)' ]      } ; }
  • 11.
    jsonp-proxy.js #2 Usage:$. get ( 'http://seivadnosaj-js.appspot.com/proxy' ,   {   url :   'http://www.jasondavies.com/media/img/jason.jpg' } ,   function ( data )   {    var  img  =   new  Image () ;   img.onload  =   function ()   {      var  w  =  img. width ,  h  =  img. height ;     $ ( '#canvas' ) . attr ( 'width' ,  w ) . attr ( 'height' ,  h ) ;     context. width   =  w ;  context. height   =  h ;     context. drawImage ( img ,   0 ,   0 ,  w ,  h ) ;    } ;   img. src   =  data ; } ,   'jsonp' ) ; Try it at:   http://seivadnosaj-js.appspot.com/
  • 12.
    Multithreaded JS (sortof) // run &quot;test&quot; in &quot;threads&quot; parallel threads a total of &quot;count&quot; times function  parallel ( test ,  count ,  threads )   {    var  pool  =   new  java. util . concurrent . Executors . newFixedThreadPool ( threads ) ;    function  runnable ( f )   {      return   new  java. lang . Runnable ({  run :   function ()   {        try   {  f () ;   }   catch ( e )   {   }      }}) ;    }    for ( var  i  =   0 ;  i  <  count ;  i  ++ )     pool. execute ( runnable ( test )) ; }
  • 13.
  • 14.
  • 15.
    RingoJS libraries searchGitHub for ringo- ringo-admin install user/repo
  • 16.
  • 17.
    RingoJS community active& friendly #ringojs on Freenode IRC #ringojs & @ringojs on Twitter http://github.com/ringo
  • 18.