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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>01 - Introduction of RequireJS</title> | |
| <script data-main="../js/mainApp.js" src="../js/require.js"></script> | |
| </head> | |
| <body> | |
| <h3> | |
| RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, | |
| but it can be used in other JavaScript environments, |
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
| <script> | |
| /* | |
| Definition | |
| $parsers/$formatters are an array of actions that take in input, | |
| translate it to either the computer-friendly or human-friendly format respectively | |
| and return the translated value. | |
| Formatters change how model values will appear in the view. | |
| Parsers change how view values will be saved in the model. |
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
| <!DOCTYPE html> | |
| <html ng-app="testApp"> | |
| <head> | |
| <title>01_simple_directive.html</title> | |
| <script type="application/javascript" src="angular.min.js"></script> | |
| <script> | |
| var testApp = angular.module('testApp', []); | |
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
| // products.js | |
| var faker = require('faker'); | |
| function generateProducts () { | |
| let products = []; | |
| for (var id = 0; id < 50; id++) { | |
| var productName = faker.commerce.productName(); | |
| var price = faker.commerce.price(); | |
| var qty = faker.finance.amount(); |
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
| const path = require('path'); | |
| let mockFile = (schema) => { | |
| return require(path.join(__dirname, 'mock/', schema)); | |
| }; | |
| module.exports = () => { | |
| return { | |
| customers: mockFile('customers.js'), | |
| products: mockFile('products.js') |
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
| if ('serviceWorker' in navigator) { | |
| window.addEventListener('load', function() { | |
| navigator.serviceWorker.register('/sw.js').then(function(registration) { | |
| // Registration was successful | |
| console.log('ServiceWorker registration successful with scope: ', registration.scope); | |
| }, function(err) { | |
| // registration failed :( | |
| console.log('ServiceWorker registration failed: ', err); | |
| }); | |
| }); |
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
| self.addEventListener('install', function(event) { | |
| // Perform install steps | |
| }); |
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
| self.addEventListener('fetch', function(event) { | |
| event.respondWith( | |
| caches.match(event.request) | |
| .then(function(response) { | |
| // Cache hit - return response | |
| if (response) { | |
| return response; | |
| } | |
| return fetch(event.request); | |
| } |
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
| // sw.js | |
| // config cache | |
| const CACHE_NAME = 'my-site-cache-assets'; | |
| const urlsToCache = [ | |
| '/', | |
| 'index.html', | |
| '/favicon.ico', | |
| '/assets/rubber-duck.png' | |
| ]; |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace Buffet | |
| { | |
| public struct Rules | |
| { | |
| public int discount; |
OlderNewer