Skip to content

Instantly share code, notes, and snippets.

View dipamsen's full-sized avatar
🙂
Active

Dipam Sen dipamsen

🙂
Active
  • India
  • 13:30 (UTC +05:30)
View GitHub Profile

Demo of features on p5 monaco editor

image

p5 functions autocompletion

image

Documentation on hover

@dipamsen
dipamsen / goroutines.go
Created November 30, 2024 06:50
Channels and Goroutines (Go)
package main
import (
"fmt"
"time"
)
func worker(done chan int) {
time.Sleep(time.Second)
done <- 2000
#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]
@dipamsen
dipamsen / ALERTS.md
Created October 23, 2023 19:41
Github Markdown alerts

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.

@dipamsen
dipamsen / guess.js
Last active October 13, 2023 07:19
Number guessing game in Discord.js using Slash Commands
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)
);
@dipamsen
dipamsen / p5-intellisense.md
Last active September 8, 2024 04:39
p5 Autocompletion in VSCode

p5 + VSCode

This guide will walk you through the process of setting up autocompletion and documentation for p5.js, right inside of VSCode.

Section 1: Using p5.js in Global Mode

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.

Step 1: Create a project folder

@dipamsen
dipamsen / react-immutable-updates.js
Last active May 9, 2023 11:13
Why we need to make immutable updates in react
// 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!
@dipamsen
dipamsen / coding-train-2023.md
Last active May 14, 2023 16:48
Coding Train 2023 Goals and Plans

Coding Train 2023 Goals and Plans

  • Challenges: (Goal: 10 challenges)
    • Wave Function Collapse Overlapping model
    • Pi Day (??)
    • 'Signed Distance Functions'
    • Secord's Algorithm (Dithering/Voronoi Stippling); info
    • Falling Sand
    • Ikeda Map (short?)
  • PID Controller
@dipamsen
dipamsen / p5.interactivity.js
Created January 1, 2023 06:32
p5 Interactivity lib for zooming and navigating an infinite canvas
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)