| Models | Examples |
|---|---|
| Display ads | Yahoo! |
| Search ads |
| // Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
| // jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
| // author: Pawel Kozlowski | |
| var myApp = angular.module('myApp', []); | |
| //service style, probably the simplest one | |
| myApp.service('helloWorldFromService', function() { | |
| this.sayHello = function() { | |
| return "Hello, World!" |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
- Stores data elements based on an sequential, most commonly 0 based, index.
- Based on tuples from set theory.
This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.
It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)
Gists don't let you specify full paths, so in the project structure the files would be:
routes-index.js --> /routes/index.js // modified to add the api endpoints
routes-api-posts.js --> /routes/api/posts.js // new file containing the Post API route controllers
| // Example 3 : Get the Eldest and Youngest Person in each gender | |
| var mongojs = require('mongojs'); | |
| var db = mongojs('mapReduceDB', ['sourceData', 'example2_results']); | |
| var mapper = function () { | |
| var x = {age : this.age, name : this.name}; | |
| emit(this.gender, {min : x , max : x}); | |
| }; |
| const schema = new Schema({ firstName: String, lastName: String }); | |
| class PersonClass { | |
| // `fullName` becomes a virtual | |
| get fullName() { | |
| return `${this.firstName} ${this.lastName}`; | |
| } | |
| set fullName(v) { |
| { | |
| "env": { | |
| "browser": true, | |
| "node": true, | |
| "es6": true | |
| }, | |
| "extends": "eslint:recommended", | |
| "parserOptions": { | |
| "sourceType": "module" | |
| }, |
From Beth Allchurch's tutorial JavaScript and Functional Programming