├── src ├── assets │ ├── .gitkeep │ ├── home │ │ ├── logo-dsta.png │ │ ├── logo-ntu.jpg │ │ ├── about-robot.jpg │ │ ├── about-taobao.jpg │ │ ├── logo-alibaba.jpg │ │ └── about-freediving.jpg │ ├── foundation-icons │ │ ├── foundation-icons.eot │ │ ├── foundation-icons.ttf │ │ ├── foundation-icons.woff │ │ └── .fontcustom-data │ └── scripts │ │ └── d3.layout.cloud.js ├── app │ ├── components │ │ ├── devt-playground │ │ │ ├── devt-playground.component.css │ │ │ ├── devt-playground.component.html │ │ │ ├── devt-playground.spec.ts │ │ │ └── devt-playground.component.ts │ │ ├── nlp-sentence-encoder │ │ │ ├── nlp-sentence-encoder.component.css │ │ │ ├── nlp-sentence-encoder.component.spec.ts │ │ │ ├── nlp-sentence-encoder.component.html │ │ │ └── nlp-sentence-encoder.component.ts │ │ ├── tfjs-timeseries-stocks │ │ │ ├── tfjs-timeseries-stocks.component.css │ │ │ ├── tfjs-timeseries-stocks.component.spec.ts │ │ │ ├── standalone_demo │ │ │ │ ├── model.js │ │ │ │ └── index.html │ │ │ ├── tfjs-timeseries-stocks-main.ts │ │ │ └── README.md │ │ ├── clustering-d3-force-chart │ │ │ ├── clustering-d3-force-chart.component.css │ │ │ ├── README.md │ │ │ ├── clustering-d3-force-chart.component.html │ │ │ ├── clustering-d3-force-chart.component.ts │ │ │ ├── clustering-d3-force-chart.component.spec.ts │ │ │ └── standalone_demo │ │ │ │ ├── index.html │ │ │ │ └── script.js │ │ ├── rl-value-function-tic-tac-toe │ │ │ ├── rl-value-function-tic-tac-toe.component.css │ │ │ ├── rl-value-function-tic-tac-toe.component.spec.ts │ │ │ ├── tic-tac-toe-agent.ts │ │ │ ├── tic-tac-toe-environment.ts │ │ │ ├── README.md │ │ │ ├── rl-value-function-tic-tac-toe.component.html │ │ │ └── rl-value-function-tic-tac-toe.component.ts │ │ ├── phrases-extraction-d3-wordcloud │ │ │ ├── phrases-extraction-d3-wordcloud.component.css │ │ │ ├── standalone_demo │ │ │ │ ├── assets │ │ │ │ │ ├── imgs │ │ │ │ │ │ ├── clouds3.png │ │ │ │ │ │ ├── stars.png │ │ │ │ │ │ └── twinkling.png │ │ │ │ │ ├── space.css │ │ │ │ │ └── cloud.js │ │ │ │ ├── index.html │ │ │ │ ├── make_wordcloud.js │ │ │ │ └── get_top_phrases.js │ │ │ ├── README.md │ │ │ ├── phrases-extraction-d3-wordcloud.component.spec.ts │ │ │ ├── phrases-extraction-d3-wordcloud.component.html │ │ │ ├── phrases-extraction-d3-wordcloud-wordcloud.js │ │ │ └── phrases-extraction-d3-wordcloud-phrases.js │ │ ├── home │ │ │ ├── home.component.css │ │ │ ├── home.component.spec.ts │ │ │ ├── home.component.ts │ │ │ └── home.component.html │ │ └── _drafts │ │ │ ├── github-api-access-repos.zip │ │ │ └── nlp-sentiment-analysis.zip │ ├── services │ │ ├── global.service.ts │ │ └── global.service.spec.ts │ ├── app.component.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app-routing.module.ts │ └── app.module.ts ├── favicon.ico ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon_angular.ico ├── index.html ├── main.ts ├── test.ts ├── polyfills.ts └── styles.scss ├── others ├── undo_changes_git.sh ├── pull_git.sh ├── push_git.sh └── cleanup.sh ├── e2e ├── tsconfig.json ├── src │ ├── app.po.ts │ └── app.e2e-spec.ts └── protractor.conf.js ├── tsconfig.app.json ├── tsconfig.spec.json ├── browserslist ├── tsconfig.json ├── .gitignore ├── karma.conf.js ├── package.json ├── tslint.json ├── angular.json └── README.md /src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /others/undo_changes_git.sh: -------------------------------------------------------------------------------- 1 | git reset --hard 2 | git clean -fd 3 | -------------------------------------------------------------------------------- /src/app/components/devt-playground/devt-playground.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/nlp-sentence-encoder/nlp-sentence-encoder.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/tfjs-timeseries-stocks/tfjs-timeseries-stocks.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /others/pull_git.sh: -------------------------------------------------------------------------------- 1 | git pull https://github.com/jinglescode/demos.git master 2 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/favicon.ico -------------------------------------------------------------------------------- /src/app/components/clustering-d3-force-chart/clustering-d3-force-chart.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/rl-value-function-tic-tac-toe/rl-value-function-tic-tac-toe.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/phrases-extraction-d3-wordcloud/phrases-extraction-d3-wordcloud.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/favicon_angular.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/favicon_angular.ico -------------------------------------------------------------------------------- /src/assets/home/logo-dsta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/assets/home/logo-dsta.png -------------------------------------------------------------------------------- /src/assets/home/logo-ntu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/assets/home/logo-ntu.jpg -------------------------------------------------------------------------------- /others/push_git.sh: -------------------------------------------------------------------------------- 1 | git add -A 2 | git commit -m "$1" 3 | git push https://github.com/jinglescode/demos.git master 4 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.css: -------------------------------------------------------------------------------- 1 | .mat-card-avatar { 2 | width: 100px; 3 | border-radius: 0%; 4 | } 5 | -------------------------------------------------------------------------------- /src/assets/home/about-robot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/assets/home/about-robot.jpg -------------------------------------------------------------------------------- /src/assets/home/about-taobao.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/assets/home/about-taobao.jpg -------------------------------------------------------------------------------- /src/assets/home/logo-alibaba.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/assets/home/logo-alibaba.jpg -------------------------------------------------------------------------------- /src/assets/home/about-freediving.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/assets/home/about-freediving.jpg -------------------------------------------------------------------------------- /src/assets/foundation-icons/foundation-icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/assets/foundation-icons/foundation-icons.eot -------------------------------------------------------------------------------- /src/assets/foundation-icons/foundation-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/assets/foundation-icons/foundation-icons.ttf -------------------------------------------------------------------------------- /src/assets/foundation-icons/foundation-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/assets/foundation-icons/foundation-icons.woff -------------------------------------------------------------------------------- /others/cleanup.sh: -------------------------------------------------------------------------------- 1 | find . -name '.DS_Store' -type f -delete 2 | find . -name 'Icon?' -type f -delete 3 | find . -name 'package-lock.json' -type f -delete 4 | -------------------------------------------------------------------------------- /src/app/components/_drafts/github-api-access-repos.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/app/components/_drafts/github-api-access-repos.zip -------------------------------------------------------------------------------- /src/app/components/_drafts/nlp-sentiment-analysis.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/app/components/_drafts/nlp-sentiment-analysis.zip -------------------------------------------------------------------------------- /src/app/components/phrases-extraction-d3-wordcloud/standalone_demo/assets/imgs/clouds3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/app/components/phrases-extraction-d3-wordcloud/standalone_demo/assets/imgs/clouds3.png -------------------------------------------------------------------------------- /src/app/components/phrases-extraction-d3-wordcloud/standalone_demo/assets/imgs/stars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/app/components/phrases-extraction-d3-wordcloud/standalone_demo/assets/imgs/stars.png -------------------------------------------------------------------------------- /src/app/components/phrases-extraction-d3-wordcloud/standalone_demo/assets/imgs/twinkling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinglescode/demos/HEAD/src/app/components/phrases-extraction-d3-wordcloud/standalone_demo/assets/imgs/twinkling.png -------------------------------------------------------------------------------- /src/app/components/devt-playground/devt-playground.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "include": [ 8 | "src/**/*.ts" 9 | ], 10 | "exclude": [ 11 | "src/test.ts", 12 | "src/**/*.spec.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('app-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/app/components/clustering-d3-force-chart/README.md: -------------------------------------------------------------------------------- 1 | # D3 Force Clustering 2 | Clustering nodes by attributes using Force chart with [D3.js](http://www.d3js.org). 3 | 4 | ## Data 5 | Data belongs to [IBM: HR Employee Attrition and Performance](https://www.ibm.com/communities/analytics/watson-analytics-blog/hr-employee-attrition/). 6 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JavaScript Exhibits 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/app/services/global.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, EventEmitter } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class GlobalService { 7 | 8 | updatePageTitle = new EventEmitter(); 9 | 10 | constructor() { 11 | 12 | } 13 | 14 | changePageTitle(title:string){ 15 | this.updatePageTitle.emit(title); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/app/services/global.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { GlobalService } from './global.service'; 4 | 5 | describe('GlobalService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: GlobalService = TestBed.get(GlobalService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/components/clustering-d3-force-chart/clustering-d3-force-chart.component.html: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | import 'hammerjs'; 8 | 9 | if (environment.production) { 10 | enableProdMode(); 11 | } 12 | 13 | platformBrowserDynamic().bootstrapModule(AppModule) 14 | .catch(err => console.error(err)); 15 | -------------------------------------------------------------------------------- /browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "esnext", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "importHelpers": true, 13 | "target": "es5", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ], 21 | "types": [ 22 | "node" 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/components/phrases-extraction-d3-wordcloud/README.md: -------------------------------------------------------------------------------- 1 | # Phrases extraction and D3 Wordcloud 2 | 100% JavaScript solution to extracting ngrams from text and display high frequency in beautiful D3 wordcloud. Phrases (ngrams) extraction are done inside *phrases-extraction-d3-wordcloud-phrases.js*, there are a few params which you could tweak and edit stopwords list. Adjustments to wordcloud can be found in *phrases-extraction-d3-wordcloud-wordcloud.js*. 3 | 4 | ## Examples 5 | View a working example [here](https://jinglescode.github.io/demos/phrases-extraction-d3-wordcloud). 6 | 7 | ## Data 8 | Data belongs to [datafiniti/Hotel Reviews](https://data.world/datafiniti/hotel-reviews). 9 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to demos!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomeComponent } from './home.component'; 4 | 5 | describe('HomeComponent', () => { 6 | let component: HomeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ HomeComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(HomeComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Title } from "@angular/platform-browser"; 3 | import { GlobalService } from "./services/global.service"; 4 | 5 | @Component({ 6 | selector: 'app-root', 7 | templateUrl: './app.component.html', 8 | styleUrls: ['./app.component.css'] 9 | }) 10 | export class AppComponent implements OnInit { 11 | 12 | title = 'Jingles'; 13 | 14 | constructor(private service: GlobalService, private titleService:Title){ 15 | 16 | } 17 | 18 | ngOnInit(){ 19 | this.updatePageTitle(); 20 | } 21 | 22 | updatePageTitle(){ 23 | this.service. 24 | updatePageTitle.subscribe((title:string) => { 25 | this.titleService.setTitle(title); 26 | this.title = title; 27 | }); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/app/components/devt-playground/devt-playground.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { DevtPlaygroundComponent } from './devt-playground.component'; 4 | 5 | describe('DevtPlaygroundComponent', () => { 6 | let component: DevtPlaygroundComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ DevtPlaygroundComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(DevtPlaygroundComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/rl-value-function-tic-tac-toe/rl-value-function-tic-tac-toe.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TicTacToeComponent } from './tic-tac-toe.component'; 4 | 5 | describe('TicTacToeComponent', () => { 6 | let component: TicTacToeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TicTacToeComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TicTacToeComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/clustering-d3-force-chart/clustering-d3-force-chart.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { GlobalService } from "../../services/global.service"; 3 | import { ClusteringD3ForceChartMain } from "./clustering-d3-force-chart-main"; 4 | 5 | @Component({ 6 | selector: 'app-clustering-d3-force-chart', 7 | templateUrl: './clustering-d3-force-chart.component.html', 8 | styleUrls: ['./clustering-d3-force-chart.component.css'] 9 | }) 10 | export class ClusteringD3ForceChartComponent implements OnInit { 11 | 12 | api_main: ClusteringD3ForceChartMain; 13 | 14 | constructor(private service: GlobalService) { } 15 | 16 | ngOnInit() { 17 | this.service.changePageTitle('Force Chart'); 18 | this.api_main = new ClusteringD3ForceChartMain(); 19 | 20 | this.api_main.init(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events.json 15 | speed-measure-plugin.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | Thumbs.db 46 | .DS_Store 47 | 48 | package-lock.json 49 | -------------------------------------------------------------------------------- /src/app/components/nlp-sentence-encoder/nlp-sentence-encoder.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { NlpSentenceEncoderComponent } from './nlp-sentence-encoder.component'; 4 | 5 | describe('NlpSentenceEncoderComponent', () => { 6 | let component: NlpSentenceEncoderComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ NlpSentenceEncoderComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(NlpSentenceEncoderComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/tfjs-timeseries-stocks/tfjs-timeseries-stocks.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TfjsTimeseriesStocksComponent } from './tfjs-timeseries-stocks.component'; 4 | 5 | describe('TfjsTimeseriesStocksComponent', () => { 6 | let component: TfjsTimeseriesStocksComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TfjsTimeseriesStocksComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TfjsTimeseriesStocksComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/clustering-d3-force-chart/clustering-d3-force-chart.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ClusteringD3ForceChartComponent } from './clustering-d3-force-chart.component'; 4 | 5 | describe('ClusteringD3ForceChartComponent', () => { 6 | let component: ClusteringD3ForceChartComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ClusteringD3ForceChartComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ClusteringD3ForceChartComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/phrases-extraction-d3-wordcloud/standalone_demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- 1 | .toolbar { 2 | position: sticky; 3 | position: -webkit-sticky; /* For macOS/iOS Safari */ 4 | top: 0; /* Sets the sticky toolbar to be on top */ 5 | z-index: 1000; /* Ensure that your app's content doesn't overlap the toolbar */ 6 | cursor: default; 7 | } 8 | 9 | .toolbar-icon { 10 | width: 36px; 11 | height: 36px; 12 | font-size: 36px; 13 | } 14 | 15 | .toolbar-spacer { 16 | flex: 1 1 auto; 17 | } 18 | 19 | .toolbar h1 { 20 | display: inline-block; 21 | font: 400 20px/36px Google Sans,sans-serif; 22 | color: rgba(0,0,0,.54); 23 | letter-spacing: 0; 24 | margin: 0; 25 | vertical-align: top; 26 | white-space: nowrap; 27 | } 28 | 29 | .toolbar a { 30 | color: #263238; 31 | } 32 | 33 | .main-container { 34 | max-width: 1400px; 35 | margin: 40px auto; 36 | padding: 0 24px; 37 | position: relative; 38 | } 39 | 40 | .mat-icon svg { 41 | height: 24px; 42 | width: 24px; 43 | } 44 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | 'browserName': 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /src/app/components/phrases-extraction-d3-wordcloud/phrases-extraction-d3-wordcloud.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PhrasesExtractionD3WordcloudComponent } from './phrases-extraction-d3-wordcloud.component'; 4 | 5 | describe('PhrasesExtractionD3WordcloudComponent', () => { 6 | let component: PhrasesExtractionD3WordcloudComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PhrasesExtractionD3WordcloudComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PhrasesExtractionD3WordcloudComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/demos'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{title}} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async(() => { 7 | TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | })); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.debugElement.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'lonedune.github.io'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.debugElement.componentInstance; 26 | expect(app.title).toEqual('lonedune.github.io'); 27 | }); 28 | 29 | it('should render title in a h1 tag', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.debugElement.nativeElement; 33 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to lonedune.github.io!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { GlobalService } from "../../services/global.service"; 3 | 4 | @Component({ 5 | selector: 'app-home', 6 | templateUrl: './home.component.html', 7 | styleUrls: ['./home.component.css'] 8 | }) 9 | export class HomeComponent implements OnInit { 10 | 11 | constructor(private service: GlobalService) { } 12 | 13 | ngOnInit() { 14 | this.service.changePageTitle('JavaScript Exhibits'); 15 | } 16 | 17 | showcases = [ 18 | { 19 | name:'Time Series Forecasting with TensorFlow.js', 20 | link:'./tfjs-timeseries-stocks', 21 | description:'Pull stock prices from online API and perform predictions using Recurrent Neural Network and Long Short-Term Memory (LSTM) with TensorFlow.js framework.' 22 | }, 23 | { 24 | name:'Reinforcement Learning Value Function with Tic Tac Toe', 25 | link:'./rl-value-function-tic-tac-toe', 26 | description:'A simple reinforcement learning algorithm for agents to learn the game tic-tac-toe. This demonstrate the purpose of the value function.' 27 | }, 28 | { 29 | name:'Phrases extraction and D3 Wordcloud', 30 | link:'./phrases-extraction-d3-wordcloud', 31 | description:'Extracting ngrams from text and display high frequency in beautiful D3 wordcloud.' 32 | }, 33 | { 34 | name:'Sentence Similarity With TensorFlow.Js', 35 | link:'./nlp-sentence-encoder', 36 | description:'Encoding sentences into embedding vectors and perform sentence similarity' 37 | } 38 | ]; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | {{showcase.name}} 26 | 27 | 28 | {{showcase.description}} 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { HomeComponent } from './components/home/home.component'; 5 | import { TfjsTimeseriesStocksComponent } from './components/tfjs-timeseries-stocks/tfjs-timeseries-stocks.component'; 6 | import { RLValueFunctionTicTacToeComponent } from './components/rl-value-function-tic-tac-toe/rl-value-function-tic-tac-toe.component'; 7 | import { PhrasesExtractionD3WordcloudComponent } from './components/phrases-extraction-d3-wordcloud/phrases-extraction-d3-wordcloud.component'; 8 | import { ClusteringD3ForceChartComponent } from './components/clustering-d3-force-chart/clustering-d3-force-chart.component'; 9 | import { NlpSentenceEncoderComponent } from './components/nlp-sentence-encoder/nlp-sentence-encoder.component'; 10 | import { DevtPlaygroundComponent } from './components/devt-playground/devt-playground.component'; 11 | 12 | const routes: Routes = [ 13 | { path: '', component: HomeComponent }, 14 | { path: 'tfjs-timeseries-stocks', component: TfjsTimeseriesStocksComponent }, 15 | { path: 'phrases-extraction-d3-wordcloud', component: PhrasesExtractionD3WordcloudComponent }, 16 | { path: 'rl-value-function-tic-tac-toe', component: RLValueFunctionTicTacToeComponent }, 17 | { path: 'clustering-d3-force-chart', component: ClusteringD3ForceChartComponent }, 18 | { path: 'nlp-sentence-encoder', component: NlpSentenceEncoderComponent }, 19 | { path: 'devt-playground', component: DevtPlaygroundComponent }, 20 | ]; 21 | 22 | @NgModule({ 23 | imports: [RouterModule.forRoot(routes)], 24 | exports: [RouterModule] 25 | }) 26 | export class AppRoutingModule { } 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demos", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e", 11 | "push": "sh ./others/push_git.sh", 12 | "pull": "sh ./others/pull_git.sh", 13 | "ghpage1": "ng build --prod --base-href 'https://jinglescode.github.io/demos/' --source-map --build-optimizer", 14 | "ghpage2": "npx angular-cli-ghpages --dir=dist/demos" 15 | }, 16 | "private": true, 17 | "dependencies": { 18 | "@angular/animations": "^8.0.0", 19 | "@angular/cdk": "^8.0.0", 20 | "@angular/common": "~8.0.0", 21 | "@angular/compiler": "~8.0.0", 22 | "@angular/core": "~8.0.0", 23 | "@angular/flex-layout": "^8.0.0-beta.26", 24 | "@angular/forms": "~8.0.0", 25 | "@angular/material": "^8.0.0", 26 | "@angular/platform-browser": "~8.0.0", 27 | "@angular/platform-browser-dynamic": "~8.0.0", 28 | "@angular/router": "~8.0.0", 29 | "@tensorflow-models/universal-sentence-encoder": "^1.1.1", 30 | "@tensorflow/tfjs": "^1.2.6", 31 | "@tensorflow/tfjs-node": "^1.2.1", 32 | "angular-plotly.js": "^1.3.2", 33 | "hammerjs": "^2.0.8", 34 | "plotly.js": "^1.48.3", 35 | "rxjs": "~6.4.0", 36 | "tslib": "^1.9.0", 37 | "zone.js": "~0.9.1" 38 | }, 39 | "devDependencies": { 40 | "@angular-devkit/build-angular": "~0.800.0", 41 | "@angular/cli": "~8.0.1", 42 | "@angular/compiler-cli": "~8.0.0", 43 | "@angular/language-service": "~8.0.0", 44 | "@types/jasmine": "~3.3.8", 45 | "@types/jasminewd2": "~2.0.3", 46 | "codelyzer": "^5.0.0", 47 | "jasmine-core": "~3.4.0", 48 | "jasmine-spec-reporter": "~4.2.1", 49 | "karma": "~4.1.0", 50 | "karma-chrome-launcher": "~2.2.0", 51 | "karma-coverage-istanbul-reporter": "~2.0.1", 52 | "karma-jasmine": "~2.0.1", 53 | "karma-jasmine-html-reporter": "^1.4.0", 54 | "protractor": "~5.4.0", 55 | "ts-node": "~7.0.0", 56 | "tslint": "~5.15.0", 57 | "typescript": "~3.4.3" 58 | }, 59 | "browser": { 60 | "crypto": false 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/app/components/clustering-d3-force-chart/standalone_demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Attrition 33 | Department 34 | Education Field 35 | Environment Satisfaction 36 | Gender 37 | JobRole 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |