background preloader

Learn

Facebook Twitter

Understanding JavaScript OOP. Now that we're able to inherit properties from other objects and extend the specialised objects to define their own behaviours, we have a little problem: what if we actually wanted to access the parent behaviours that we just overwrote?

Understanding JavaScript OOP

JavaScript provides the Object.getPrototypeOf function, that returns the [⁣[Prototype]⁣] of an object. This way, we have access to all properties defined within the prototype chain of an object. So, accessing a property in the parent of an object is quite simple: So, a naïve solution for applying a method stored in the [⁣[Prototype]⁣] of an object to the current one, would then follow, quite naturally, by looking the property on the [⁣[Prototype]⁣] of this: This looks all good and well, but there's a little catch: it will enter in endless recursion if you try to apply this approach to more than one parent. So, the last example becomes: Como perder peso (no browser) Superhero.js. ECMAScript. Nodejs_resource.markdown. Develop a RESTful API Using Node.js With Express and Mongoose... Serving Static Files from Node.js.

Posted: 5/6/2011 12:14 PM In the last post I showed you how to get started with Node.js on Windows.

Serving Static Files from Node.js

Easy, wasn’t it? Remarkably so since there was no install requirement. This time we are going to tweak the system a bit then learn how to return static files like plain ol’ Html, Css and Javascript files. Note, for posterity's sake, that all of this is based on node.js as of version 0.4.7. Making Things Easier Last time we got started by unzipping the file that contained all the node files. Computer > Right-click and hit properties > Advanced System Settings (on the left) > Environment Variables > System Variables > Path > add “C:\Program Files\Node” NowJS and Node.js Tutorial – Creating a multi room chat client. Node.js is a server side environment for Javascript.

NowJS and Node.js Tutorial – Creating a multi room chat client

NowJS is a framework built on top of Node.js that connects the client side and server side Javascript effortlessly. The core of NowJS functionality lies in the now object.The now object is special because it exists on the server and the client.This means variables you set in the now object are automatically synced between client and server. Also server functions can be directly called on the client and client functions can be called directly from the server.All in realtime. You can have a working HTTP server up and running in Node.JS with just a few lines of code. For example - This little snippet of code will create an HTTP server, listen on port 8080, and send back “Hello World” for every request.

Using NowJS, communication between the client and server side is just as simple. Developer Network. From game jam to mobile and Firefox OS I love participating in game jams, where game developers get together to craft games in a very short amount of time.

Developer Network

I thought it would be cool to take one of my past Game Jam games, Metal vs Hipsters, and port it to the mobile web and Firefox OS. Adapting ... Getting Started with Node.js on Heroku. Node Table of Contents This quickstart will get you going with Node.js and the Express web framework, deployed to Heroku.

Getting Started with Node.js on Heroku

For general information on how to develop and architect apps for use on Heroku, see Architecting Applications for Heroku. Prerequisites If you’re new to Heroku or Node.js development, you’ll need to set up a few things first: A Heroku user account. Local workstation setup Once installed, you can use the heroku command from your command shell. Heroku login Enter your Heroku credentials. Press enter at the prompt to upload your existing ssh key or create a new one, used for pushing code later on. Write your app You may be starting from an existing app. Var express = require("express"); var logfmt = require("logfmt"); var app = express(); app.use(logfmt.requestLogger()); app.get('/', function(req, res) { res.send('Hello World! ') Declare dependencies with npm. Designing Better JavaScript APIs. Advertisement At some point or another, you will find yourself writing JavaScript code that exceeds the couple of lines from a jQuery plugin.

Designing Better JavaScript APIs

Your code will do a whole lot of things; it will (ideally) be used by many people who will approach your code differently. They have different needs, knowledge and expectations. This article covers the most important things that you will need to consider before and while writing your own utilities and libraries. We’ll focus on how to make your code accessible to other developers.

Peter Drucker once said: “The computer is a moron.” Table of Contents Fluent Interface The Fluent Interface1 is often referred to as Method Chaining (although that’s only half the truth). Aside from major simplifications, jQuery offered to even out severe browser differences. Method Chaining The general idea of Method Chaining6 is to achieve code that is as fluently readable as possible and thus quicker to understand. Command Query Separation Going Fluent Consistency Callbacks.