Skip to content

Instantly share code, notes, and snippets.

Kevin Faaborg zootella

Block or report user

Report or block zootella

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<!doctype html>
<html>
<head>
<title>blah4</title>
<style>
body {
max-width: 680px;
margin: 0 auto;
}
View links.html
View spin5.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>spin5</title>
<script src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="http://cdn.jsdelivr.net/bluebird/3.5.0/bluebird.min.js"></script>
</head>
<body>
View gist:fd34ac2f5a8063bc3f93be439317265c
stream workshop ideas
[big file]
read a small file into memory to get its size
read a big file into memory, see that break
fix it with a stream that counts the bytes as they come in
[zip]
zip a file
unzip a file
View test.js
console.log("file\\");
var test = require("tape");
var tap_spec = require("tap-spec");
var tap_json = require("tap-json");
var stream_buffers = require("stream-buffers");
//run these like "$ node popquiz.js 1" and so on
var n = process.argv[2];
View testing without a terminal
console.log("file\\");
var test = require("tape");
var tap_spec = require("tap-spec");
var tap_json = require("tap-json");
var stream_buffers = require("stream-buffers");
//run these like "$ node popquiz.js 1" and so on
var n = process.argv[2];
View int.js
//1. native operators, best looking but depends on primitive types or operator overloading
if (1 + 5 - 2 <= 9) return;
//2. methods, correct java-inspired design employed by most modules
if (int(1).add(5).subtract(2).lessThanOrEqualTo(9)) return;
//3. first custom design, works alongside 2
if (int(1)._("+", 5)._("-", 2)._("<=", 9)) return;
View run.js
var platformChildProcess = require("child_process");
function demo(name) { return process.argv[2] == "demo" && process.argv[3] == name; }
var log = console.log;
function trim(d) { return (d+"").trim(); }
/*
goals
View hello2.js
console.log("hello 2");
process.stdin.resume();//standard in starts paused by default, resume it to be able to get data
process.stdin.on("data", function(d) {//we got some data
console.log("hello 2 received data:");
console.log(d+"");//turn it into a string before logging it to standard out
});
/*
View hello1.js
console.log("hello 1");
/*
try running
$ node hello1.js
logs out "hello 1" and exits
*/
You can’t perform that action at this time.