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
| module.exports = function(first,last){ | |
| var msg = 'Hi Mr. '.concat(last).concat(', or maybe I should say: Hi! ').concat(first); | |
| console.log(msg); | |
| } |
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
| class Greetings{ | |
| spanish(){ | |
| let msg = `Hello Mr. ${this.last}, or Maybe I should say: Hi ${this.first}!`; | |
| return msg; | |
| } | |
| english(){ | |
| let msg = `Hola Sr. ${this.last}, o quisas deba decir: Hola ${this.first}!`; | |
| return msg; | |
| } | |
| } |
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
| export default (document)=>{ | |
| let btn = document.querySelector('#say-hello'), | |
| txt = document.querySelector('#your-name'), | |
| hello = document.querySelector('#hello-you'); | |
| btn.onclick =()=>{ | |
| hello.textContent = 'Hello '.concat(txt.value).concat('!'); | |
| } | |
| } |
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
| var rest = require('rest-facade'), | |
| POST_ID = 1, | |
| Posts = new rest.Client('http://jsonplaceholder.typicode.com/posts/:id'), | |
| CommentsPerPost = new rest.Client('http://jsonplaceholder.typicode.com/posts/:id/comments'); | |
| Posts | |
| .get({id:POST_ID}) | |
| .then(function(post){ | |
| console.log("--- POST ---"); | |
| console.log(post); |
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
| function myFunc(){ | |
| var prvValue = 5; | |
| this.setPrvValue = function(val){ | |
| prvValue = val; | |
| } | |
| this.getPrvValue = function(){ | |
| return prvValue; | |
| } | |
| } |
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
| angular.module('myApp',[]) | |
| .controller('myCtrl',['myService',function(service){ | |
| var self = this; | |
| self.values = []; | |
| self.reloadValues = function(){ | |
| service.getValues().then( | |
| function(values){ | |
| self.values = values; |
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
| describe('myCtrl Tests',function(){ | |
| var ctrl = null, | |
| service = null; | |
| beforeEach(module('myApp')); | |
| beforeEach(inject(function(_myService_,$controller){ | |
| ctrl = $controller('myCtrl',{ | |
| myService : _myService_ | |
| }); |
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
| describe('myCtrl Tests',function(){ | |
| var ctrl = null, | |
| goodResponse = [1,2,3,4,5], | |
| badResponse = new Error('Something is failing...'), | |
| serviceMock = function(successful){ | |
| return { | |
| getValues : function(){ | |
| return { | |
| then : function(resolve,reject){ | |
| if(successful){ |
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
| /** | |
| * We just require 3 libraries: webpack, the dev server of webpack and our config file | |
| */ | |
| var WebpackDevServer = require('webpack-dev-server'), | |
| webpack = require('webpack'), | |
| config = require('./webpack.config.js'); | |
| /** | |
| * First, we need to compile our configuration, let's translate our configuration to webpack instrutions. | |
| * This process is exactly the same that we see when we run just webpack, it will create a new "bundle" file |
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
| var gulp = require('gulp'), | |
| webpack = require('webpack-stream'), | |
| browserify = require('browserify'), | |
| uglify = require('gulp-uglify') | |
| source = require('vinyl-source-stream'), | |
| buffer = require('vinyl-buffer'); | |
| gulp.task('browserify',function(){ | |
| return browserify('./app/entry.js') | |
| .bundle() |
OlderNewer