Note
Highlights information that users should take into account, even when skimming.
Important
Crucial information necessary for users to succeed.
Warning
Critical content demanding immediate user attention due to potential risks.
#include <stdio.h> | |
int main() | |
{ | |
int arr[5] = {1, 2, 3, 4, 5}; | |
arr; // int[5]; array | |
&arr; // int (*)[5]; pointer to an array (note that (int *)[5] would be an array of pointers) | |
&arr[0]; // int *; pointer to an int | |
*arr; // int; arr decays it to its initial pointer (&arr[0]) then dereferencing gives arr[0] |
Note
Highlights information that users should take into account, even when skimming.
Important
Crucial information necessary for users to succeed.
Warning
Critical content demanding immediate user attention due to potential risks.
import { SlashCommandBuilder } from "discord.js"; | |
import { gameInfo } from "./startgame.js"; | |
export const data = new SlashCommandBuilder() | |
.setName("guess") | |
.setDescription("Guess a number between 1 and 100") | |
.addIntegerOption((option) => | |
option.setName("number").setDescription("Your guess").setRequired(true) | |
); |
// Coding Train Video Linker: converts youtube links into Coding train website relative paths, on thecodingtrain.com | |
// (add file to node-scripts/) | |
import fs, { copyFileSync } from 'fs'; | |
import path from 'path'; | |
import { globSync } from 'glob'; | |
import clipboard from 'clipboardy'; | |
const videos = []; |
This guide will walk you through the process of setting up autocompletion and documentation for p5.js, right inside of VSCode.
In this section, we will guide you through the process of setting up autocompletion and documentation for p5.js in VSCode when using p5.js in Global Mode without a bundler.
// Why do we need to create copies of state in react? | |
// =================================================================== | |
// Mock state and setState functions | |
let items = [{ name: "item 1", id: "1" }, { name: "item 2", id: "2" }]; | |
const setItems = (newVal) => { | |
// React first checks if the new state passed in has changed or not, from the current state. | |
if (newVal === items) { // only checks for reference, not value! |
p5.prototype._initVals = function () { | |
this.int_zoom = 1; | |
this.int_offset = this.createVector(0, 0); | |
this.mouseWheel = mouseWheel1.bind(this) | |
this.mouseDragged = mouseDragged1.bind(this) | |
}; | |
p5.prototype.registerMethod('init', p5.prototype._initVals) |
// MouseDrag - movable canvas | |
// p5.js | |
// function draw() | |
// translate(offset) | |
// .. | |
// } | |
function mouseDragged(event) { | |
offset.add(event.movementX * 0.9, event.movementY * 0.9) |