Skip to content

Instantly share code, notes, and snippets.

View jasonfigueroa's full-sized avatar

Jason Figueroa jasonfigueroa

View GitHub Profile
@jasonfigueroa
jasonfigueroa / debug-javascript-in-visual-studio-code.md
Last active September 17, 2022 22:56
How to Debug JavaScript in Visual Studio Code

How to Debug JavaScript in Visual Studio Code

Required software:

  • Google Chrome
  • Visual Studio Code (VS Code)
  • Live Server Extension for VS Code

Configure the Debugger

Note: The following is a screenshot of the Live Server Extension.

@jasonfigueroa
jasonfigueroa / docker-compose.yml
Created August 1, 2021 02:23
A docker-compose file for a local MySQL database.
version: '3.1'
services:
db:
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password
volumes:
- mysql_data:/var/lib/mysql
restart: "no" # 'always' would start this service each time my machine is powered on
ports:
const fibonacci_memo = () => {
const memo = {};
const fibonacci = (n) => {
if (n in memo) {
return memo[n];
} else if (n === 0) {
return 0;
} else if (n <= 2) {
return 1;
const fib = (n) => {
if (n === 0) {
return 0;
} else if (n <= 2) {
return 1;
}
return fib(n - 1) + fib(n - 2);
};
// returns formatted time in minutes and seconds as a string
const formattedTime = (timeInMilliseconds) => {
const time = timeInMilliseconds;
let timeStr = "";
const minutes = Math.floor(time / 60000);
const seconds = (time % 60000) / 1000;
return `${ minutes } minutes and ${ seconds } seconds`;
// An example of a valid parameter is Date.now()
const timer = (startTimeInMilliseconds) => {
const startTime = parseFloat(startTimeInMilliseconds);
return (endTimeInMilliseconds) => {
const endTime = parseFloat(endTimeInMilliseconds);
return endTime - startTime;
};
};