Skip to content

Instantly share code, notes, and snippets.

@menduz
menduz / actionlist.vim
Created April 19, 2024 13:22 — forked from zchee/actionlist.vim
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@menduz
menduz / gi.c
Created December 6, 2023 20:33 — forked from futureengine2/gi.c
Radiance Cascades 2d GI implementation
static void gi_on_gpu(u8* in_bitmap, int w, int h) {
#define num_cascades 7
static bool initialized;
static gpu_bindgroup_t texture_bindgroup[2];
static gpu_bindgroup_t cascade_uniform_bindgroup[num_cascades];
static gpu_bindgroup_t render_uniform_bindgroup;
static gpu_buffer_t vertex_buffer;
static gpu_buffer_t uniform_buffer;
static gpu_pipeline_t pipeline;
@menduz
menduz / build.zig
Last active September 20, 2023 20:16
zig dependency checker
const DependencyChecker = struct {
/// map(module_name -> set(module_hash))
package_name_to_hashes: std.StringHashMap(std.StringHashMap(bool)),
const Self = @This();
const dependencies = @import("root").dependencies;
fn check_transitive_dependency(self: *Self, comptime module_name: []const u8, comptime module_hash: []const u8, comptime level: comptime_int) void {
const package = @field(dependencies.packages, module_hash);
const BITS = 32
export function queryBit(data: Uint32Array, index: number) {
const mask = 1 << (index % BITS)
return (data[(index / BITS) | 0] & mask) != 0
}
export function turnOnBit(data: Uint32Array, index: number) {
const mask = 1 << (index % BITS)
return (data[(index / BITS) | 0] |= mask)
}
Use cases:
- Edition mode, needs component schemas and IDs
```
entity0: {
position: { x y z }
}
```
- If the devs define the component number, libraries may have conflicting numbers
export function asnEcdsaSignatureParser(signature: Uint8Array): {
r: BigNumber
s: BigNumber
} {
// 30 — type tag indicating SEQUENCE
// 46 — length in octets of value that follows
// 02 — type tag indicating INTEGER
// 21 — length in octets of value that follows
// 00 b15232269023d8c65689f816996f6af874b484347f1e7a537df1230cb1b12d76 R
@menduz
menduz / guide.md
Last active May 11, 2022 09:19
Frontend React + TypeScript guidelines

Directory Structure

The sources of the project follows this structure:

/src
  /app
    /{domain}
      /actions.ts
 /actions.spec.ts
import { ILoggerComponent, IMetricsComponent } from '@well-known-components/interfaces'
import { validateMetricsDeclaration } from '@well-known-components/metrics'
import PQueue from 'p-queue'
export type ISequecuentialJobExecutorComponent = {
/**
* Runs sequential jobs with a max concurrency of 1 per jobName.
*/
run<T>(jobName: string, fn: () => Promise<T>): Promise<T>
}
@menduz
menduz / dcl.md
Created November 24, 2020 00:55
How to implement your own Decentraland, quick and dirty

Runtime

Decentraland run scenes inside a WebWorker, in an ES5 context including Fetch + WebSockets + dcl object.

Every generated scene should run by itself. That is, a piece of code that can be evaluated by an eval in a proper context. You can compile scenes using Webpack, esbuild, or the Decentraland CLI.

The scenes will interact with the renderer using the dcl object.

dcl object

@menduz
menduz / transform.dwl
Created October 11, 2017 16:48
DataWeave prime number generator
%dw 2.0
output application/json
import some from dw::core::Arrays
fun isPrime(num: Number): Boolean = do {
// try primes <= 16
if (num <= 16)
(num == 2) or (num == 3) or (num == 5) or (num == 7) or (num == 11) or (num == 13)
else if ( // cull multiples of 2, 3, 5 or 7