This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Author: Michael Weibel <michael.weibel@gmail.com> | |
| * License: MIT | |
| */ | |
| var passport = require('passport') | |
| , StrategyMock = require('./strategy-mock'); | |
| module.exports = function(app, options) { | |
| // create your verify function on your own -- should do similar things as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Node.js testing: | |
| 1. Use the package lab (also code and sinon). | |
| npm install lab --save-dev | |
| npm install code --save-dev // assertion library | |
| npm install sinon --save-dev | |
| 2. Add the following test script to your package.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var userRolesInNewApp = [ | |
| {displayName: 'tester', value: 't'}, | |
| {displayName: 'hacker', value: 'h'}, | |
| {displayName: 'manager', value: 'm'} | |
| ]; | |
| var object = { | |
| appRoles: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| const {$}= Ember; //JQuery reference for events | |
| import layout from '../templates/components/checkbox-component'; | |
| const { | |
| Component, | |
| get | |
| } = Ember; | |
| const MyComponent = Ember.Component.extend({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| const {$}= Ember; //JQuery reference for events | |
| import layout from '../templates/components/checkbox-component'; | |
| const { | |
| Component, | |
| get | |
| } = Ember; | |
| const MyComponent = Ember.Component.extend({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'EAM V.2.0.0' | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle', | |
| yenConverter: Ember.inject.service(), | |
| actions: { | |
| switchCurrency(){ | |
| this.get('yenConverter').switchCurrency(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To add code completion for node.js | |
| ================================== | |
| sudo npm install typings --global | |
| typings search --name node | |
| typings install env~node --global --save | |
| Then I added the following to the top of my index.js file. | |
| /// <reference path="typings/index.d.ts"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Regex tips for JOI: | |
| ^ asserts that the regular expression must match at the beginning of the subject | |
| [] is a character class - any character that matches inside this expression is allowed | |
| A-Z allows a range of uppercase characters | |
| a-z allows a range of lowercase characters | |
| . matches a period rather than a range of characters | |
| \s matches whitespace (spaces and tabs) | |
| _ matches an underscore | |
| - matches a dash (hyphen); we have it as the last character in the character class so it doesn't get interpreted as being part of a character range. We could also escape it (\-) instead and put it anywhere in the character class, but that's less clear |