- refactor(rules): refactor 'valid-by-tagname' rule (f83a4b9)
This file contains 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 GOODREADS_KEY = process.env.GOODREADS_KEY; | |
const cors = "https://cors-anywhere.herokuapp.com/"; | |
const goodreads = "https://www.goodreads.com/"; | |
const goodreadsURL = cors + goodreads + "search/index.xml?"; | |
const bookURL = cors + goodreads + "book/show.xml?"; |
This file contains 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
// Take a union of Rules later. For Testing! TODO | |
const rules = [ | |
// {pattern:/\t+|\n+|\d+|([a-zA-Z_]\w*)|\;|\{|\}|\]|\[|\(|\)|\+|\-|\*|\/|( +)|\=|\'|\>|\<|\.(?=\w+)/g, name:'all'}, | |
{ pattern: /^\s/, name: "WhiteSpace" }, | |
{ pattern: /^\[/, name: "OpenBracket" }, | |
{ pattern: /^\]/, name: "CloseBracket" }, | |
{ pattern: /^\(/, name: "OpenParen" }, | |
{ pattern: /^\)/, name: "CloseParen" }, | |
{ pattern: /^\{/, name: "OpenBraces" }, | |
{ pattern: /^\}/, name: "CloseBraces" }, |
This file contains 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
// Generate Matrices | |
const matrices = generateMatrices(); | |
const A = matrices.A; | |
const B = matrices.B; | |
//CPU | |
const startCPU = window.performance.now(); | |
const cpuResult = cpuMatMult(A, B); | |
const endCPU = window.performance.now(); | |
const cpuTime = endCPU - startCPU; |
This file contains 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 generateMatrices() { | |
const matSize = 512; | |
let A = []; | |
let B = []; | |
for (let n = 0; n < matSize * matSize; n++) { | |
const randA = Math.random(); | |
const randB = Math.random(); | |
A.push(randA); | |
B.push(randB); | |
} |
This file contains 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 gpuMatMult = gpu.createKernel(function (A, B) { | |
var sum = 0; | |
for (var i = 0; i < 512; i++) { | |
sum += A[this.thread.y][i] * B[i][this.thread.x]; | |
} | |
return sum; | |
}) | |
.setDimensions([A.length, B.length]) | |
.setOutputToTexture(true); |
This file contains 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 cpuMatMult(m, n) { | |
var result = []; | |
for (var i = 0; i < m.length; i++) { | |
result[i] = []; | |
for (var j = 0; j < n[0].length; j++) { | |
var sum = 0; | |
for (var k = 0; k < m[0].length; k++) { | |
sum += m[i][k] * n[k][j]; | |
} | |
result[i][j] = sum; |
This file contains 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 lang='en'> | |
<head> | |
<meta charset='UTF-8'> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0'> | |
<meta http-equiv='X-UA-Compatible' content='ie=edge'> | |
<title>gpu.js demo</title> | |
<script src='gpu-core.min.js'></script> |
This file contains 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
#extension GL_EXT_draw_buffers : require | |
precision highp float; | |
precision highp int; | |
precision highp sampler2D; | |
const float LOOP_MAX = 100.0; | |
#define EPSILON 0.0000001; | |
uniform highp vec3 uOutputDim; | |
uniform highp vec2 uTexSize; |
This file contains 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
#extension GL_EXT_draw_buffers : require | |
precision highp float; | |
precision highp int; | |
precision highp sampler2D; | |
const float LOOP_MAX = 100.0; | |
#define EPSILON 0.0000001; | |
uniform highp vec3 uOutputDim; | |
uniform highp vec2 uTexSize; |