Skip to content

Instantly share code, notes, and snippets.

@psxcode
psxcode / index.js
Created August 30, 2018 20:01
rasterize test
'use strict'
var data
var width
var height
var scale = 6
var cred = (255 << 24) | 255
var credd = (255 << 24) | 100
var cgreen = (255 << 24) | (255 << 8) | 100
@psxcode
psxcode / canvas.ts
Created August 10, 2018 22:04
canvas draw snippets
export interface ICanvas {
width: number;
height: number;
halfWidth: number;
halfHeight: number;
ctx: CanvasRenderingContext2D;
image: ImageData;
buffer: ArrayBuffer;
buffer8: Uint8ClampedArray;
buffer32: Uint32Array;
@psxcode
psxcode / ts-tips.ts
Last active August 8, 2018 13:04
ts-tips
/**
* Make all properties in T optional
*/
type Partial<T> = {
[P in keyof T]?: T[P];
};
/**
* Make all properties in T required
*/
@psxcode
psxcode / cmake.md
Last active July 24, 2018 15:57
CMake

CMake

Organization

  • Directories contain CMakeLists.txt, add by add_subdirectory
  • Scripts are <script>.cmake files that can be executed with cmake -P <script>.cmake. Not all commands are supported
  • Modules are <script>.cmake files located in CMAKE_MODULES_PATH directory. Can be loaded with include() command

Generator expressions

target_compile_definition(foo
@psxcode
psxcode / gtor-outlines.md
Last active January 2, 2019 13:54
GTOR outlines

Value

  • singular
  • spacial
  • sync

Getter / Setter

  • singular
  • sync
  • unicast
@psxcode
psxcode / cps_hof_compose.md
Last active July 23, 2018 14:10
CPS vs HOF vs Compose

CPS vs HOF vs Compose

CPS

Continuation Passing Style Node async API style

function doWork(p0, p1, done) {
  var results = p0 + p1
  done(null, results)
}