background preloader

MEAN Stack: Using with Node

Facebook Twitter

Colección de clases y ejercicios para emplear MEAN con API's y Node.js

Flattening Promise Chains | The Solution Optimist. Promises are a great solution to address complexities of asynchronous requests and responses. AngularJS provides Promises using services such as $q and $http; other services also use promises, but I will not discuss those here. Promises allow developers to easily attach 1x-only notifications of response to any asynchronous request/action. Promises also enable two (2) other very important things. We can: Transform the responses before subsequent handlers (in the chain) are notified of the response.Use the response to invoke more async requests (which could generate more promises). But even more important than the features above, Promises support easy chaining of custom activity or computations. …and we will also discuss the some of hidden anti-patterns Below I explore and discuss the hidden power in chain promises. The FlightDashboard Consider the Travel Service shown which loads information about the user’s upcoming travel departure.

Nesting Promise Chains Flattened Promise Chains Finally. PeerJS - Examples. Edit fiddle. A Beginner's Guide to MongoDB & Meteor, Part 1. One of the difficult parts of writing a technical book is deciding when to introduce certain ideas. The topics that need to be taught are consistent between books, but the order in which you talk about them can drastically affect the reader’s ability to grasp certain content.

More often than not, for instance, technical authors try to talk about creating an interface as soon as possible. This is because it’s fun to see the visual results of your code, and it’s nice to feel like you’re making quick progress. But this approach does introduce a couple of problems: It’s harder to grasp anything relating to the front-end (the interface) when you’re not familiar with the back-end (the database, etc). As such, we’ll start by talking about creating and managing a database within our project. MongoDB vs. If you’ve built something on the web before, you’ve probably come into contact with some kind of database.

By default, every Meteor project comes with its own database. Create a Collection Summary. How to install PhantomJS on Debian/Ubuntu. Cal-HeatMap : Calendar Heat map with d3.js. Setup This will insert a new calendar into #cal-heatmap in your page, and fill it with data from datas.json. By default, the calendar will display 12 hours, divided into 60 minutes. There's a lot of other settings available to customize your calendar. Examples With Default values By default, cal-heatmap will always display 12 hours, split into 60 minutes each. Unless you set the date property in init(), the calendar will start at the beginning of the current hour. var calendar = new CalHeatMap(); calendar.init({}); Days > hours Display all the hours for 10 days, starting from January 15th, 2000. PreviousNext JsFiddlevar calendar = new CalHeatMap(); calendar data: "datas-years.json", start: new Date(2000, 0, 15), id : "graph_b", domain : "day", subDomain : "hour", range : 10, browsing: true, afterLoadNextDomain: function (start, end) { alert("You just loaded a new domain starting on " + start + " and ending on " + end); }}); Months > days Display all days, for 3 months, from February 2000.

Theme. Node.js Quickstart  |  Google Calendar API  |  Google Developers. How to get the url parameters using angular js. Mongodb/node-mongodb-native. Now It's Simple. Services and Dependency Injection. As you've seen in Controllers and $scope (Please note: this chapter has not yet been released) AngularJS makes heavy use of Dependency Injection (DI) to retrieve references to components. In this chapter, we'll show you how AngularJS uses DI and how you can inject your own objects into controllers and services for your applications. A 30 Second Intro to Dependency Injection DI is a pattern which is often used in infrastructure components and which ensures that one particular component does not directly create references to other components.

Instead of direct instantiation, every component will receive references to required other components like helpers, services, etc. as parameters to their constructor. (Yes, we realize that this is a very simplified definition as there is more than just constructor injection, but for the scope of AngularJS, this should be sufficient for now. In this case, $scope gets injected by Angular whenever this controller is instantiated.

Well-Known Services. Fb. With facebook-node-sdk you can now easily write the same code and share between your server (nodejs) and the client (Facebook Javascript SDK). This SDK will report usage of which AppID is using it directly to Facebook. Author: Thuzi License: Apache v2 npm install fb var FB = require'fb'; Update appId and appSecret in samples/scrumptious/config.js npm install cd samples/scrumptious node app.js Graph Api Get FBapi'4' if! Console.log! Return; console.logresid; console.logresname; Passing Parameters FBapi'4' fields: 'id' 'name' Post FBsetAccessToken'access_token'; var body = 'My first post using facebook-node-sdk'; FBapi'me/feed' 'post' message: body console.log'Post Id: ' + resid; Delete var postId = '1234567890'; FBapipostId 'delete' console.log'Post was deleted'; Facebook Query Language (FQL) Query FBapi'fql' q: 'SELECT uid FROM user WHERE uid=me()' console.logresdata; Multi-query FBapi'fql' q: 'SELECT uid FROM user WHERE uid=me()' 'SELECT name FROM user WHERE uid=me()' console.logresdata0fql_result_set; Named Multi-query.

The web's scaffolding tool for modern webapps | Yeoman. KeystoneJS · Getting started. Angulartics | Web analytics for AngularJS applications. The Wonderful Duo — Using Meteor and AngularJS Together. Now, we talk about their conflicts Here is a list of things that I found Meteor and AngularJS don’t like each other about or don’t agree on: Script load order (namely, when angular.js is loaded)Bootstrapping of ngAppLoading of Angular template files, and template delimiter {{…}}Declaration and usage of Meteor collectionsCode minification Before walking through each of this list together, I want to also briefly list my solutions to the problems (and you can skip the rest if you don’t care for technical details): Follow a runlevel-like convention of organizing files.Instead of using ng-app on <html> or <body>, use it on a page container <div>.Change Angular template delimiter to something else, organize template files under Meteor’s convention, and load all templates from Meteor’s Template at start.Declare Meteor collections at global scope, create a wrapping function around Meteor’s Deps.autorun for data binding.Follow Angular’s dependency injection convention on EVERY occasion.

Load order. The Wonderful Duo — Using Meteor and AngularJS Together. Angular directives for Bootstrap. The $uibPosition service provides a set of DOM utilities used internally to absolute-position an element in relation to another element (tooltips, popovers, typeaheads etc...). getRawNode(element) Takes a jQuery/jqLite element and converts it to a raw DOM element. parameters element(Type: object) - The element to convert. returns (Type: element) - A raw DOM element. parseStyle(element) Parses a numeric style value to a number. Value(Type: string) - The style value to parse.

(Type: number) - The numeric value of the style property. offsetParent(element) Gets the closest positioned ancestor. element(Type: element) - The element to get the offset parent for. (Type: element) - The closest positioned ancestor. scrollbarWidth(isBody) Calculates the browser scrollbar width and caches the result for future calls. IsBody(Type: boolean, Default: false, optional) - Is the requested scrollbar width for the body/html element. (Type: number) - The width of the browser scrollbar. position(element, includeMargins) How can AngularJS bind to list of checkbox values? Xls-to-json. Implement Custom Gestures — Web Fundamentals. Add Event Listeners Touch events and mouse events are implemented on most mobile browsers. The event names you need to implement are touchstart, touchmove, touchend and touchcancel. For some situations, you may find that you would like to support mouse interaction as well; which you can do with the mouse events: mousedown, mousemove, and mouseup.

For Windows Touch devices, you need to support Pointer Events which are a new set of events. Pointer Events merge mouse and touch events into one set of callbacks. This is currently only supported in Internet Explorer 10+ with the prefixed events MSPointerDown, MSPointerMove, and MSPointerUp and in IE 11+ the unprefixed events pointerdown, pointermove, and pointerup. Touch, mouse and Pointer Events are the building blocks for adding new gestures into your application (see Touch, mouse and Pointer events). Include these event names in the addEventListener() method, along with the event’s callback function and a boolean. AngularJS Directive Design Made Easy. AngularJS directives are cool AngularJS is a web application framework that makes creating complicated web applications much simpler. One of its best features is the ability to create directives, or reusable web components. It gives you the ability to create new HTML tags and attributes, which can dynamically display content in response to data changes, as well as update the data when appropriate.

They’re a big productivity booster because they let you wrap up a complicated interaction with the DOM in a nice, reusable package. Making directives is confusing at first It doesn’t take long to realize that directives are useful, and the ones that are bundled with AngularJS are well designed, but making directives can feel overwhelming at first. The Angular team has done a good job making directives extremely powerful and flexible, but all that power comes with some complexity. How do I talk to a directive? Directive design principles The user-list directive works. That’s enough theory for today. How to Send e-mail using Node.js | Code for geek. In this tutorial i am going to discuss about sending e-mail with Node.js. I have already covered Express.js tutorials and in this tutorial also i am going to use Express.js and NodeMailer package.

In many forums and blogs people used to ask about sending e-mail’s using Node.js for account verification, password recovery and promotion. So let’s begin with tutorial and at the end you will have Node application which is able to send e-mail’s to any one’s account. Links: Watch live Demo on YouTube here and Download it from Github here. What we are Building ? Create package.json file and keep it in any folder. Once done. Implementing Server.js: Let’s begin with creation of our Server file. Var express=require('express'); var nodemailer = require("nodemailer"); var app=express(); app.listen(3000,function(){ console.log("Express Started on Port 3000"); }); This is basic block of our app.

App.get('/',function(req,res){ res.sendfile('index.html'); }); Email is been sent at "+to+" . How can AngularJS bind to list of checkbox values? Snap.svg API Reference. Creates a gradient element gradient string gradient descriptor Gradient Descriptor The gradient descriptor is an expression formatted as follows: <type>(<coords>)<colors>. The <type> can be either linear or radial. The uppercase L or R letters indicate absolute coordinates offset from the SVG surface. Examples Linear gradient, relative from top-left corner to bottom-right corner, from black through red to white: var g = paper.gradient("l(0, 0, 1, 1)#000-#f00-#fff"); Linear gradient, absolute from (0, 0) to (100, 100), from black through red at 25% to white: var g = paper.gradient("L(0, 0, 100, 100)#000-#f00:25%-#fff"); Radial gradient, relative from the center of the element with radius half the width, from black to white: var g = paper.gradient("r(0.5, 0.5, 0.5)#000-#fff"); To apply the gradient:

Draggable Dual-View Slideshow. Lorem Waldy Distilling design and other interesting methods It was not child's play tackling those horses. Some of the kind-hearted station folk in the backblocks had sent down some wild warrigals of the West; bucking brumbies that beat the band; old outlaws off the grass that the station hands could never master. But Colonel Cox ("Fighting Charlie" we called him) had in his command some of the crack rough-riders of Australia. And it was a joy to see these men tackle the outlaws. There were Crouch of Wagga, McDonald of Barrington, Whiteley of Wellington, Bullock of Melbourne, Sievewright of Gunnedah, Kennedy of Gloucester, Rex Moffatt of Goulburn, Harry Heath of Moree, and a score of others.

Nearly every man in the regiment could sit a buck, or puff nonchalantly at his pipe while his mount pigrooted merrily. So when the wild horses were led forth there were hundreds volunteering for the honour of riding the rebels. But even a plague of locusts does not last for ever—and Egypt does. Meteor. Simplest example. A live-updating high score list. Try it yourself In about 3 minutes, you'll make your own copy of Leaderboard and deploy it live on the Internet for you and your friends to use. No programming knowledge required! Pick a name for your new app.I'll call it... Install Meteor (if you haven't already). Look around the source code Leaderboard is very simple — under 50 lines of JavaScript, a significant fraction of which is the list of scientists! The parts of Leaderboard: A MongoDB collection (leaderboard.js:4) which holds the players and their current scores. The only other code is the CSS in leaderboard.css.

Make some changes Ready to edit your copy of Leaderboard? $ meteor Now point your web browser at localhost:3000. Here are some ideas to get you started: Make a button that toggles between sorting by score and sorting by name. When you're ready to push your changes live to the internet for all of your users, simply run meteor deploy once again. Excited? Get on the mailing list! Outils Google pour les webmasters. AngularJS SEO, BackboneJS SEO, or EmberJS SEO. Assuming you've signed up with Heroku and you've downloaded the Heroku Toolbelt $ heroku create $ git push heroku master That's it! On the command line, you'll see the url of your new Prerender service on Heroku. npm install prerender --save server.js Prerender uses plugins similar to the way Node uses middleware.

Your plugins can implement any of the following methods: init() Called when you call server.use(require('my_plugin')); beforePhantomRequest(req, res, next) Called at the beginning of the request lifecycle, before phantomjs starts to load the url. Use this function to short circuit the lifecycle. Ex. OnPhantomPageCreate(page, res, next) Called after the phantomjs page has been created Use this function to bind to custom phantomjs events Ex. AfterPhantomRequest(res, next, next) Called at the end of the request lifecycle, after phantomjs successfully loads the HTML for a url. Use this function to access/modify the HTML returned from a url. Ex. BeforeSend(req, res, next) Ex. That's it!

Twilio Cloud Communications - APIs for Voice, VoIP and Text Messaging. Jonjenkins/express-upload · GitHub. Bevacqua/campaign. Mailchimp/email-blueprints.

METEOR Stack: Node Meteor MongoDB

Pricing - Mandrill. Send Better Email | MailChimp. Bevacqua/campaign · GitHub. Emailjs. Nodemailer. Send e-mails from Node.js – easy as cake! Upgrade warning Do not upgrade Nodemailer from 0.7 or lower to 1.0 as there are breaking changes. You can continue to use the 0.7 branch as long as you like. See the documentation for 0.7 here. Migration guide See the migration guide from 0.7 to 1.0 in the 1.0 release blog post. Notes and information Nodemailer supports Unicode to use any charactersWindows – you can install it with npm on Windows just like any other module, there are no compiled dependencies.

Support Nodemailer development If you want to support with Bitcoins, then my wallet address is 15Z8ADxhssKUiwP3jbbqJwA21744KMCfTM TL;DR Usage Example This is a complete example to send an e-mail with plaintext and HTML body See nodemailer-smtp-transport for SMTP configuration options and nodemailer-wellknown for preconfigured service names (example uses 'gmail').

Goals for 1.0 1. Nodemailer 0.x is quite large and includes a ton of stuff that is not needed for most users. 2. Setting up Install with npm. Mailgun-js. Meteor Roadmap. Apiary — Home. API Overview · TryGhost/Ghost Wiki · GitHub. Pad/Q87tcpTZKRtwNFSZF. Node.js - MEAN Stack - Pass form from Angular to Express to be emailed by Nodemailer. Heap | Mobile and Web Analytics. Jiangmiao/node-curl. Mailgun-js. Andris9/Nodemailer. Creating a simple contact form with angular.js and express.js. Node.js - MEAN Stack - Pass form from Angular to Express to be emailed by Nodemailer. SublimeVideo. Danialfarid/angular-file-upload. Hackathon-starter/app.js at master · sahat/hackathon-starter. Hackathon-starter/app.js at master · sahat/hackathon-starter · GitHub. Dan Wahlin - Learning AngularJS by Example – The Customer Manager Application. The Big Badass List of Twitter Bootstrap Resources.

Node.js. Setting Up a MEAN Stack Single Page Application. Build a real-time polls application with Node.js, Express, AngularJS, and MongoDB. Dan Wahlin - Learning AngularJS by Example – The Customer Manager Application. AngularJS — Superheroic JavaScript MVW Framework. Creating a Single Page Todo App with Node and Angular. MongoDB.

Getting MEAN. Easy Node Authentication. Build a RESTful API Using Node and Express 4. Single Page Apps with AngularJS Routing and Templating. Setting Up a MEAN Stack Single Page Application.