Skip to content

Instantly share code, notes, and snippets.

View colevandersWands's full-sized avatar

Evan Cole colevandersWands

View GitHub Profile
let counter = 0;
let scope = undefined;
const scopeof = new WeakMap();
const callstack = [];
const stack = [];
let studentCode = "";
let transitions = [];
let states = [];
@colevandersWands
colevandersWands / evaluation.js
Created December 9, 2020 09:57
simple DOM testing
'use strict';
window.addEventListener('DOMContentLoaded', () => {
const assert = (assertion, message) => {
if (assertion) {
console.log('%cPASS: ', 'color: green;', message);
} else {
console.log('%cFAIL: ', 'color: red;', message);
}
};
@colevandersWands
colevandersWands / extractor.js
Last active January 12, 2021 15:59
BBB Screenshare extractor CLI
'use strict';
/* generate mp4's of the screenshare + audio from a BBB hosted recording
$ node this-file.js meeting-id name-of-output-file keep
- meeting-id (required) a big blue button meeting id, you can find this in the URL for recorded sessions.
the script will exit early if this is not provided
- name-of-output-file (optional) the output file name should not include an extension, just the name.
defaults to class-recording.mp4

Behavior, Strategy, Implementation

In this module you will explore different ways to break down and solve coding challenges. Along with structured workflows for approaching challenges, you will learn the JavaScript you need to write clear and maintainable solutions including: reading and writing tests, higher order functions, arrays and object.

Behavior

What does the function do? What are it’s arguments and it’s return value? How could you use it in a program? Behavior is all about what your function looks like "from the outside", without caring about what is written inside.

Functions behavior is generally described using use cases, documentation and/or unit tests:

/*
this script uses ../index.json to run & evaluate each .js file in /exercises
after the review is finished it writes a README for each folder of exercises in /review
*/
// require dependencies (native node modules)
const path = require('path');
const fs = require('fs');
// require evaluation & reporting scripts (non-native, stored in /lib)
const fs = require("fs");
const path = require("path");
const config = require("../config.json");
const EXERCISES_DIR = path.normalize(path.join(__dirname, '..', config.path));
const EXAMPLE_WORDS = ['example', 'examples', 'worked', 'stepped', 'demo'];
const PARENT_DIR = path.normalize(path.join(__dirname, '..'));
try {
fs.accessSync(EXERCISES_DIR);
/*
this file opens a server that can only send files after reading them directly from the file system
files are accessed by trying to find a file path matching the url path exactly
it keeps a log of each request/response cycle in /server-logs
*/
// require other people's code to use it in this script
// these dependencies all come pre-installed with node
const http = require('http');
const fs = require('fs');
// require dependencies
const fs = require('fs');
const path = require('path');
const nodeFetch = require('node-fetch');
const assert = require('assert');
// declare constants
const START = Date.now();
const NOW = () => `${Date.now() - START} ms: `;
const REPORT_NAME = path.basename(__filename).replace('.js', '-report.txt');
const cowsay = require('cowsay');
const fs = require('fs');
const COWSAID_DIRNAME = 'cowsaid';
const DOC_STRING = `CONFG OPTIONS
text:"lorem ipsum" -- what the cow should say
default -- I cow hard
e:"oo" -- the cow's eyes.
not all cowfiles have customizable eyes
2 characters only is recommended