Skip to content

Instantly share code, notes, and snippets.

@emabeee
emabeee / debugging.md
Last active September 10, 2025 12:08
Complete the "Debugging" exercises (Links to an external site.) in the "JavaScript Algorithms and Data Structures" section.

Use the JavaScript Console to Check the Value of a Variable

Both Chrome and Firefox have excellent JavaScript consoles, also known as DevTools, for debugging your JavaScript. You can find Developer tools in your Chrome's menu or Web Console in Firefox's menu. If you're using a different browser, or a mobile phone, we strongly recommend switching to desktop Firefox or Chrome. The console.log() method, which "prints" the output of what's within its parentheses to the console, will likely be the most helpful debugging tool. Placing it at strategic points in your code can show you the intermediate values of variables. It's good practice to have an idea of what the output should be before looking at what it is. Having check points to see the status of your calculations throughout your code will help narrow down where the problem is. Here's an example to print the string Hello world! to the console: console.log('Hello world!'); Use the console.log() method to print the value of the variable a where noted in t

@emabeee
emabeee / es6.exercises.md
Last active September 10, 2025 12:08
Complete the "ES6" exercises (Links to an external site.) in the "JavaScript Algorithms and Data Structures" section.

Compare Scopes of the var and let Keywords

When you declare a variable with the var keyword, it is declared globally, or locally if declared inside a function. The let keyword behaves similarly, but with some extra features. When you declare a variable with the let keyword inside a block, statement, or expression, its scope is limited to that block, statement, or expression.

For example:

var numArray = [];
for (var i = 0; i < 3; i++) {
 numArray.push(i);
@mugifly
mugifly / image-predict-on-tfjs-node.js
Last active January 7, 2024 16:11
Image Prediction on tfjs-node (with model made by Teachable Machine Image)
const tf = require('@tensorflow/tfjs-node');
const Jimp = require('jimp');
// Directory path for model files (model.json, metadata.json, weights.bin)
// NOTE: It can be obtained from [Export Model] -> [Tensorflow.js] -> [Download my model]
// on https://teachablemachine.withgoogle.com/train/image
const MODEL_DIR_PATH = `${__dirname}`;
// Path for image file to predict class
const IMAGE_FILE_PATH = `${__dirname}/example.jpg`;
@tomgp
tomgp / package.json
Last active August 10, 2025 22:10
Server side SVG via D3 & jsdom
{
"name": "simple-node-d3",
"version": "1.0.0",
"description": "Serverside SVG via D3 & jsdom",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "tom.g.pearson@gmail.com",
"license": "ISC",
@michaelt
michaelt / latex.template
Created June 9, 2011 21:23
Simple Pandoc default.latex with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.