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
| <React.Fragment> | |
| <video | |
| ref={(videoElementRef: HTMLVideoElement) => | |
| (videoElement = videoElementRef) | |
| } | |
| autoPlay={true} | |
| playsInline={true} | |
| muted={true} | |
| style={{ visibility: 'hidden', position: 'fixed' }} | |
| /> |
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 drawImageOnCanvas = ( | |
| videoElem: HTMLVideoElement, | |
| canvasElem: HTMLCanvasElement | |
| ) => { | |
| const ctx = canvasElem.getContext('2d') as CanvasRenderingContext2D; | |
| const canvasResolution = 224; | |
| ctx.drawImage(videoElem, 224, 0, size, size, 0, 0, 224, 224); | |
| }; |
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 { timer, Subject, from, Observable } from 'rxjs'; | |
| export function createWebcam(webcam: HTMLVideoElement): Observable<{}> { | |
| return from( | |
| new Promise<{}>((resolve, reject) => { | |
| if (navigator.getUserMedia) { | |
| navigator.getUserMedia( | |
| { video: true }, | |
| stream => { | |
| webcam.srcObject = stream; |
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 function initializeWebcam( | |
| videoElem: HTMLVideoElement, | |
| canvasElement: HTMLCanvasElement | |
| ) { | |
| return createWebcam(videoElem).pipe( | |
| switchMap(_ => | |
| timer(0, 40).pipe( | |
| map(() => drawImageOnCanvas(videoElem, canvasElement)) | |
| ) | |
| ) |
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 'jest-preset-angular'; |
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
| { | |
| "name": "webpack-jest", | |
| "version": "1.0.0", | |
| "description": "jest, webpack and typescript", | |
| "main": "src/main.ts", | |
| "scripts": { | |
| "test": "jest" | |
| }, | |
| "repository": { | |
| "type": "git", |
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 PureHiCluster(clusters: Vector[Cluster], distances: Map[(String, String), Double]) { | |
| def generateClusterCalculations(clusters: Vector[Cluster], distances: Map[(String, String), Double], pairData: PairData) = { | |
| def loop(clusters: Vector[Cluster], futureResults: List[Future[(Map[(String, String), Double], PairData)]]): List[Future[(Map[(String, String), Double], PairData)]] = | |
| clusters match { | |
| case Vector() => futureResults | |
| case x +: xs => loop(xs, Future[(Map[(String, String), Double], PairData)] { computeDistances(clusters.dropWhile { y => y.id != x.id}, distances, x, pairData) } +: futureResults) | |
| } | |
| loop(clusters, List()) |
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
| def processFile = { | |
| val lines = importFile(file) | |
| val columnHeaders = lines.head.split("\\s *").toVector | |
| val vectorLength = columnHeaders.length | |
| val rows = lines.tail.zipWithIndex.map { case (x, i) => | |
| val cells = x.split("\\s *") | |
| cells match { | |
| case x if ( x.length != vectorLength ) => { | |
| println("There is missing data in row " + i + ". Skipping..") |
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
| case class DataContainer(columnHeaders: Vector[String], rows: Vector[Vector[Option[Double]]]) |
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
| name := "HiClusterer" | |
| version := "1.0" | |
| scalaVersion := "2.10.6" | |
| resolvers += "spray repo" at "http://repo.spray.io" | |
| resolvers += "spray nightlies" at "http://nightlies.spray.io" |
NewerOlder