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
// Sample for reading a file asynchronously using libuv | |
// taken from https://www.snip2code.com/Snippet/247423/Sample-for-reading-a-file-asynchronously | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <uv.h> | |
static uv_fs_t openReq; | |
static uv_fs_t readReq; |
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
"use strict" | |
function matprint(mat) { | |
const shape = [mat.length, mat[0].length]; | |
function col(mat, i) { | |
return mat.map(row => row[i]); | |
} | |
const colMaxes = []; | |
for (let i = 0; i < shape[1]; i++) { | |
colMaxes.push(Math.max.apply(null, col(mat, i).map(n => n.toString().length))); |