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

Appitecture

 Appitecture

'Ved Jå

April 30, 2016
Tweet

Other Decks in Programming

Transcript

  1. SIMPLE JAVASCRIPT TEASER :D  Write a simple JavaScript function

    to find the intersection of two arrays using only string functions. Given var x = [1,2,3,4,5,6,7,8]; and var y = [1,2,3,3,3,5]; Your function should return ["1" , "2" , "3" , "5"]  Rules  Use only in-built javascript string functions  No loops / array iterator functions (e.g. filter, map, forEach, each, some e.t.c.)  No external / 3rd party libraries
  2. WHAT IS APPITECTURE?  Appitecture is a simple code generator

    (and manager) that helps scaffold project route handlers and controllers. (The current build is suited only for Node JS projects using the Express framework)
  3. WHAT IS APPITECTURE?  Appitecture is a simple code generator

    (and manager) that helps scaffold project route handlers and controllers. (The current build is suited only for Node JS projects using the Express framework)  (While the current build only supports Njs projects using the Express framework, it can be modified for use with other languages (and frameworks) that follow the MVC pattern.)
  4. Internals  Appitecture is made up of 3 main modules

     Directure –This module (stand-alone) handles all file system related operations  Grammar Parser – Reads the appitecture.apt file, parses our the route paths, handlers, middlewares, controller functions  Generator –Takes parsed information from the Grammar Parser and uses it to generate files ( and directories)
  5. APT file Syntax  The first two lines of an

    apt file define the configurations to be used by the parser  The remaining lines define the application routes, controllers (if any) and HTTP methods.
  6. Roadmap  Create basic parser and generator [done]  Add

    refactoring module  Add / Define more configuration options
  7. TEASER SOLUTION var x = [1,2,3,4,152,6,7,8,1,1,1,3,3,3,3,3]; var y = [1,2,3,5,152,3,3,3];

    var xstr = x.toString(); var ystr = y.toString(); var xstrr = "\\b" + xstr.replace(/,/g,'\\b|\\b') + "\\b"; var intersection = ystr.match(new RegExp(xstrr,'g')); var ms = {}; var inter =[]; var intersection_cleaned = intersection.toString().replace(/\b\d+\b/g,function(m,i){ if(!ms[m]) inter.push(m); ms[m] = 1; return m; }); console.log(inter );