Skip to content

Instantly share code, notes, and snippets.

@dnkm
dnkm / journal.md
Last active March 14, 2026 07:23
game dev journal

Outline

This document will guide you through creating a small indie game from idea to release.

The goal is not to create a perfect game, but to learn the process of designing, building, testing, and finishing a game.

A finished small game is better than an unfinished big game.

Project Timeline (3 months):

@dnkm
dnkm / loading.md
Created February 4, 2026 22:34
pyodide

The best practice for loading Pyodide involves using a CDN for simple, fast integration, utilizing Web Workers to keep the main thread responsive, and using for package management. As Pyodide constitutes a full Python interpreter load (~tens of MBs), performance optimization is critical. [1, 2, 3, 4, 5]
Here are the best practices for loading Pyodide:

  1. Initial Loading (CDN vs. Local)

• Use CDN for Development/Simplicity: The easiest method is to load directly from the jsDelivr CDN: • Host Locally for Production: For better control, reliability, and offline capabilities, download the Pyodide files and serve them from your own web server. • Asynchronous Initialization: Always load Pyodide asynchronously to prevent blocking the browser's main thread: [1, 2, 6, 7, 8]

  1. Performance & Threading
@dnkm
dnkm / 01_basic.cpp
Created April 1, 2025 23:55
c++ pointers and references
#include <bits/stdc++.h>
using namespace std;
int main() {
int x = 10;
cout << x << endl;
cout << &x << endl;
cout << *(&x) << endl;
int *y = &x;
@dnkm
dnkm / Bank.java
Last active February 26, 2025 01:54
Katherine - private class - 2025 Feb 25
class Bank {
private int balance;
public Bank(int initBalance) {
balance = initBalance;
}
public void add(int amt) {
if (amt <= 0) {
System.out.println("huh?");
@dnkm
dnkm / id-cache.ts
Created May 19, 2020 22:18
indexeddb cache
import Dexie from "dexie";
import { addMinutes } from "date-fns";
import { firestore } from "firebase";
const DB_NAME: string = "id_cache";
const DB_VER: number = 1;
class IdCache {
db: Dexie;
@dnkm
dnkm / sphera.js
Last active February 27, 2019 01:27
Sphera Project
class Sphera {
constructor({
x = 0,
y = 0,
radius = 10,
color = Sphera.colors[parseInt(Math.random() * Sphera.colors.length)],
speed = 1,
angle = 0,
text = '',
border = 0,
@dnkm
dnkm / dijkstra.java
Last active October 28, 2018 23:34
dijk
import java.util.*;
public class dijk {
public static void main(String[] args) {
Graph g = new Graph(9);
g.addEdge(0, 1, 4);
g.addEdge(0, 7, 8);
g.addEdge(1, 2, 8);
g.addEdge(1, 7, 11);
@dnkm
dnkm / Messages.js
Created October 14, 2018 08:33
junha, justin
import React, { Component } from 'React';
import {
StyleSheet,
Text,
View,
Dimensions,
TextInput,
TouchableOpacity,
ScrollView,
Keyboard
@dnkm
dnkm / App.js
Created September 9, 2018 05:06
side menu demo
import React from 'react';
import { StyleSheet, Text, View, Button, Dimensions, Animated, Easing, TouchableOpacity } from 'react-native';
const SideMenu = () => (
<View>
<Text>Open up App.js to start working on your app!</Text>
<Text>Changes you make will automatically reload.</Text>
<Text>Shake your phone to open the developer menu.</Text>
</View>
);
Broken Necklace
You have a necklace of N red, white, or blue beads (3<=N<=350) some of which are red, others blue, and others white, arranged at random. Here are two examples for n=29:
1 2 1 2
r b b r b r r b
r b b b
r r b r
r r w r
b r w w