monarchwadia's notebooks

  • Conway's game of life using @monarchwadia/conways-game-engine (expand the log output!) - /monarchwadia/conways-game-engine-simple-example
    Last edited 5 years ago
    const { ConwaysGameEngine } = require("@monarchwadia/conways-game-engine") /** / Expand the console output! Youll have \ | to press the little arrow to the left | | of each log. A bit tedious. But trust | \ me, its worth it! / --------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || */ const FONT = { [1]: "# ", [0]: ". ", default: "? " } // init engine const engine = new ConwaysGameEngine(); /* Draw a glider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # . . . . . . . . . . # . . . . . . . # # # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ engine.draw(3, 4); engine.draw(4, 5); engine.draw(5, 5); engine.draw(5, 4); engine.draw(5, 3); renderer(engine); // CALCULATE for (var i = 0; i < 10; i++) { engine.step(); renderer(engine); } // Other stuff function renderer(engine) { const { world, config } = engine; const { rowSize, colSize } = config; let string = ''; for (let row = 0; row < rowSize; row++) { for (let col = 0; col < colSize; col++) { const value = world[row][col]; const font = FONT[value] || FONT.default; string += font; } string += '\r\n'; } // render console.log(string); }
  • How to find a domain's registration date with Node.js - ZeroProjects.ca - /monarchwadia/how-to-find-a-domain-s-registration-date-with-node-js---zeroprojects-ca
    Last edited 5 years ago
    This post is in response to a question asked on Reddit: https://www.reddit.com/r/learnprogramming/comments/ahn4tx/any_idea_how_to_scrapefind_this_data/ You can find out the Updated Date, Creation (Registration) Date, Expiration Date and other interesting pieces of registry information about a website via the WHOIS protocol. Here's an example Node.js snippet showing you how. Cloneable code: https://github.com/ZeroProjectsInc/snippets/tree/master/whois - Courtesy of Zero Projects, a software development firm in Toronto, Canada. You can see more about us at https://zeroprojects.ca