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
" Vim Code Dark (color scheme) | |
" with some customizations by Liz | |
" https://github.com/tomasiser/vim-code-dark | |
" | |
" NOTE: PUT THIS INSIDE A /colors FOLDER!!! | |
" My directory structure is like: | |
" .vim/ folder contains: | |
" vimrc (file, notice there's no . before the name) | |
" colors/ folder containing several color themes, including this one |
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
module.exports = class TicTacToe { | |
constructor() { | |
this.board = [ | |
["", "", ""], | |
["", "", ""], | |
["", "", ""] | |
]; | |
this.currentPlayer = "X"; | |
this.lastMove; // keep track of most recent move, for hasWon() check |
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
// Type JavaScript here! |
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
// Just a quick example of a generator function, | |
// mostly borrowed from https://davidwalsh.name/async-generators | |
function request(param) { | |
console.log("called request() with " + param); | |
makeAsyncCall( param, function(response){ | |
it.next( response ); | |
} ); | |
} |
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
export function helper(x) { | |
console.log(x); | |
} |
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
///////////////////////////////////////////////////////////////////////////////////// | |
// Using code from recursionExample.js, modifying it to try to visualize with p5js | |
// ToC: | |
// - animateRecursivelyAddToTen(sum, frameQueue) | |
// - drawFrame(frameQueue, currentIndex) | |
// - Params for drawing, global vars: counter for clicks, frameQueue | |
// - Set up event listener and run clickHandler > run drawFrame | |
// - Set up p5js (setup() and unused draw() function) | |
///////////////////////////////////////////////////////////////////////////////////// |
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
///////////////////////////////////////////////////////////////////////////////////// | |
// GENERATING A RANDOM BINARY SEARCH TREE of a given height (numeric data) | |
// Next to-do: Generate a BST of a given number of nodes ? | |
///////////////////////////////////////////////////////////////////////////////////// | |
///////////////// SET UP AS STEP-THROUGH VERSION ///////////////////// | |
document.addEventListener("click", drawRandomBST); | |
// PARAMETERS FOR FUNCTION: |
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
///////////////////////////////////////////////////////////////////////////////////// | |
// GENERATING AND DRAWING TREES OF n LEVELS -- for now, easy mode -- perfect binary trees | |
// Note: using p5js for drawing functions; didn't include p5js setup() here | |
///////////////////////////////////////////////////////////////////////////////////// | |
/////////////////////////////////////////////// | |
// SETUP / INITIALIZING VARIBALES | |
/////////////////////////////////////////////// |
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
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
// Loops, and stepping through loops one step at a time, triggered by an external event | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
let testArray = [1,2,3,4,5]; | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
// FIRST -- a simple while loop, for comparison: | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
let index = 0; |
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
///////////////////////////////////////////////////////////////////////// | |
// Replacing parts of a string with incremental numbers | |
//////////////////////////////////////////////////////////////////////// | |
// This code snippet finds 1 to 2 digit numbers in a string matching a pattern | |
// (hard-coded for now), and replaces each number with itself + 1 | |
// **** For a very specific use case, but easy enough to repurpose as needed :) | |
// Regex matches 1 to 2 digits preceded by the string ": | |
function replaceNumbersWithIncrement(givenString) { |
NewerOlder