Skip to content

Instantly share code, notes, and snippets.

View dezashibi's full-sized avatar
🎯
Focusing on my targets

Navid Dezashibi dezashibi

🎯
Focusing on my targets
View GitHub Profile
@RednibCoding
RednibCoding / 0 Odin debugging on windows.md
Last active June 23, 2024 15:10
Odin debugging on windows with vscode. See: readme

Setup

To setup debugging for Odin programs on Windows with VsCode follow these steps:

  • make sure you have the C/C++ extension pack (VsCode extension) installed
  • create a .vscode folder at the root of your Odin project
  • copy the launch.json and tasks.json into it
  • click on the debug tab in VsCode, then click on the debug button at the top (or press F5)

Note: if you want to use a starter template which also sets up a tracking allocator which tracks and reports memory leaks you can use: https://github.com/RednibCoding/Odin-Starter

@mbforbes
mbforbes / ecs-dirty-aspects.ts
Created January 4, 2022 22:22
TypeScript ECS w/ dirty Component optimization and Aspects
/**
* An entity is just an ID. This is used to look up its associated
* Components.
*/
export type Entity = number
/**
* A Component is a bundle of state. Each instance of a Component is
* associated with a single Entity.
@gingerBill
gingerBill / wasm4_wasm32.odin
Last active April 4, 2024 09:33
WASM-4 Odin bindings
// WASM-4: https://wasm4.org/docs
package wasm4
foreign import wasm4 "env"
#assert(size_of(int) == size_of(u32))
// ┌───────────────────────────────────────────────────────────────────────────┐
// │ │
// │ Platform Constants │
@mbforbes
mbforbes / ecs-dirty.ts
Last active March 14, 2024 07:07
ECS implementation w/ dirty Component optimization
namespace P02 {
/**
* An entity is just an ID. This is used to look up its associated
* Components.
*/
type Entity = number
/**
@mbforbes
mbforbes / minimal-ecs.ts
Created September 5, 2021 06:50
A minimal but complete Entity Component System (ECS) implementation in 99 lines.
type Entity = number
abstract class Component { }
abstract class System {
public abstract componentsRequired: Set<Function>
public abstract update(entities: Set<Entity>): void
public ecs: ECS
}
type ComponentClass<T extends Component> = new (...args: any[]) => T
class ComponentContainer {
private map = new Map<Function, Component>();
@mbrochh
mbrochh / 01_utils.py
Last active September 24, 2023 10:45
Using pagination with Django, graphene and Apollo
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
# First we create a little helper function, becase we will potentially have many PaginatedTypes
# and we will potentially want to turn many querysets into paginated results:
def get_paginator(qs, page_size, page, paginated_type, **kwargs):
p = Paginator(qs, page_size)
try:
page_obj = p.page(page)
except PageNotAnInteger: