• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
What I learned from FluentConf and then some

What I learned from FluentConf and then some






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    What I learned from FluentConf and then some What I learned from FluentConf and then some Presentation Transcript

    • Node.js• Debugging using node: – node --debug hello.js – kill -s USR1 <pid> - switch to debug – node-inspector - remote debug• For long synchronous tasks (calculations), one should spawn a new Node instance• Cluster – spawning multiple instances• Proxies – varnish, HAProxy are faster than NGINX
    • Node.js• One can use IPC (http://dailyjs.com/2012/04/26/node-unix- ipc/) to sync up Node instances• Better yet, use an in-memory database (see Redis, perhaps also Socket.IO’s RedisStore)• There is A LOT of talk about Socket.IO• One can implement process.on(uncaugtException) to avoid the instance crashing
    • Node.js• For all events in Node (EventEmitter), one can register for a SINGLE event (once) and not have to manage memory.• Winston – a logging tool for node• Express 3 implements many high-level HTTP features (compression, caching)
    • Tools• www.caniuse.com - which browsers support a feature• <script src="//foo.com/widget.js"> - protocol agnostic• z• live compiling, plugins for live update of JS, CSS• Learn to better use your toolset
    • Back-End Tools• Speed testing: – http://www.webpagetest.org/ – http://httparchive.org/• blackhole.webpagetest.org – to test missing JS resources• Not ready yet: http://www.stevesouders.com/blog/2012/05/ 22/self-updating-scripts/
    • JavaScript• Many languages compile into JavaScript – CoffeeScript • IcedCoffeeScript• Some implemented __DEBUG_WARNING preprocessing directives (js-build-tools)• Chrome can now emulate touch events• Never use try-catch for an async operation• You can create inline SVG with JS• webkitRequestFullScreen()
    • Frameworks• Comparison of template engines: http://engineering.linkedin.com/frontend/clie nt-side-templating-throwdown-mustache- handlebars-dustjs-and-more• One can translate AI files into Raphael code• TreeHugger for layout of long-form content• Backbone.JS, CoffeeScript, Bootstrap, Socket.IO, MongoDB, Redis, Derby, Meteor, Grunt
    • Redis.IO• Fast, in-memory cache – Size limited to memory – Good for ephemeral data (cache, session), for syncing servers• Can be saved to disk, mostly for faster start up• Key-value storage• Support strings, integers, floats, sets (+operations), sorted sets, and hashes. – Native to developers• Makes the developer think about the implications of large- scale• In JavaScript, set operations are unidirectional, get async• Supports pub-sub, transactions, LUA scripts
    • Internal Suggestions• Compiling our templates to JS code• For ads: To communicate some configuration to a script tag use s.setAttribute(data-config, whatever); instead of <script>var config=”whatever"</script>, and find it by its URL.• Have only minified + gzipped output and use source maps to understand errors• We can terminate SSL on NGINX instead of Node
    • Leftovers• Read “Maintainable JavaScript”• You should write better code• See how racist you are: https://implicit.harvard.edu/implicit/demo/ta keatest.html